← Back to index
|
Original Bugzilla link
Bug 18286 – std.algorithm.comparison.cmp for string with custom predicate fails if distinct chars can compare equal
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-01-23T07:35:39Z
Last change time
2018-01-26T21:23:32Z
Assigned to
No Owner
Creator
Nathan S.
Comments
Comment #0
by n8sh.secondary — 2018-01-23T07:35:39Z
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!"); } ```
Comment #1
by n8sh.secondary — 2018-01-26T21:23:32Z
Fixed
https://github.com/dlang/phobos/pull/6056
https://github.com/dlang/phobos/commit/7f59e5ad526ee4bf856e8235e3042bb5cd442ad4