http://d.puremagic.com/issues/show_bug.cgi?id=5502
--- Comment #2 from [email protected] 2013-02-06 04:38:07 PST --- Currently if you want to create an associative array with constant values you have to use something like: import std.array: assocArray; import std.range: zip, repeat; void main() { bool[dchar] dcharSet = assocArray(zip("ABCD", repeat(true))); } In Python the dict has a static method "fromkeys" that is handy: >>> dict.fromkeys("ABCD", True) {'A': True, 'C': True, 'B': True, 'D': True} A possible similar Phobos function: import std.array: AAFromKeys; void main() { bool[dchar] dcharSet = AAFromKeys("ABCD", true); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
