Comment #0 by bearophile_hugs — 2014-02-12T04:50:36Z
It seems a SortedRange doesn't define a proper hash protocol:
void main() {
import std.algorithm: sort;
import std.range: SortedRange;
int[SortedRange!(dchar[], "a < b")] AA;
dchar[] a = "hello"d.dup;
dchar[] b = a.dup;
AA[a.sort()] = 5;
AA[b.sort()] = 10;
assert(AA.length == 1);
}
DMD 2.065beta3 gives at run-time:
core.exception.AssertError@test2(9): Assertion failure
My suggestion is to make a SortedRange not hashable (so it gives a compile time error if you try to use it as associative array key), or implement inside it a correct hash protocol.
Comment #1 by k.hara.pg — 2014-07-05T08:13:09Z
*** This issue has been marked as a duplicate of issue 11037 ***