void main()
{
import std.stdio : writeln;
["key": 10, "key" : 20, "key" : 30].length.writeln;
["key" : 30].length.writeln;
}
This prints:
3
1
In general, duplicate keys in literals should probably be disallowed anyway:
https://issues.dlang.org/show_bug.cgi?id=11637
Comment #1 by gassa — 2017-02-03T07:18:45Z
Stumbled across this one, too:
https://forum.dlang.org/post/[email protected]
My use case is as follows:
foreach (i; 0..10)
foreach (j; 0..10) if (pred2 (i, j))
foreach (k; 0..10) if (pred3 (i, j, k))
... and maybe more ...
{
auto set = [i: true, j: true; k: true];
if (set.length == 3)
{
... we found distinct i, j, k, ...
}
}