[Issue 5502] More handy ways to create associative arrays
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Feb 10 23:19:54 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=5502
Seb <greensunny12 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |bootcamp
CC| |greensunny12 at gmail.com
--- Comment #5 from Seb <greensunny12 at gmail.com> ---
> import std.array: AAFromKeys;
> void main() {
> bool[dchar] dcharSet = AAFromKeys("ABCD", true);
> }
This is already easily possible today:
---
assocArray("ABCD".zip(true.repeat)).writeln;
---
https://run.dlang.io/is/7j1ObE
We could add another overload to assocArray that accepts two arguments: values
+ keys
-> PR: https://github.com/dlang/phobos/pull/6155
--
More information about the Digitalmars-d-bugs
mailing list