digitalmars.D.bugs - [Issue 18286] New: std.algorithm.comparison.cmp for string with
- d-bugmail puremagic.com (33/33) Jan 22 2018 https://issues.dlang.org/show_bug.cgi?id=18286
https://issues.dlang.org/show_bug.cgi?id=18286 Issue ID: 18286 Summary: std.algorithm.comparison.cmp for string with custom predicate fails if distinct chars can compare equal Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: normal Priority: P3 Component: phobos Assignee: nobody puremagic.com Reporter: n8sh.secondary hotmail.com Discussion: https://github.com/dlang/phobos/pull/6056#issuecomment-359701089 Example: https://run.dlang.io/is/feq4KK ``` void main() { import std.algorithm.comparison : cmp; static bool lessThanCaseInsensitive(size_t a, size_t b) { import std.ascii : toUpper; return toUpper(cast(dchar) a) < toUpper(cast(dchar) b); } static assert(cmp!lessThanCaseInsensitive("apple2", "APPLE1") != 0, "These are clearly not the same!"); } ``` --
Jan 22 2018