[Issue 6254] New: Problem with associative array with array of array as keys
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 5 10:48:34 PDT 2011
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 at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at 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 at 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: -------
More information about the Digitalmars-d-bugs
mailing list