digitalmars.D.bugs - [Issue 6254] New: Problem with associative array with array of array as keys
- d-bugmail puremagic.com (38/38) Jul 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6254
http://d.puremagic.com/issues/show_bug.cgi?id=6254 Summary: Problem with associative array with array of array as keys Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: druntime AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc --- Comment #0 from bearophile_hugs eml.cc 2011-07-05 10:43:33 PDT --- This program: static immutable(char[][]) toConstMatrix(char[][] M) { immutable(char[])[] result; foreach (row; M) result ~= row.idup; return result; } void main() { char[][] M = [" ".dup, " ".dup, " ".dup, " ".dup, " ".dup]; auto a = toConstMatrix(M); auto b = toConstMatrix(M); bool[char[][]] foo; foo[a] = true; assert(a == b, "a != b"); assert(a in foo, "a not in foo"); assert(b in foo, "b not in foo"); } DMD 2.053 gives: core.exception.AssertError test.d(15): b not in foo But I think the hash of a dynamic array of a dynamic array has to be computed on just the contents (and lengths) of the arrays. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 05 2011