[Issue 20617] New: There is no support for copying hashmaps in Druntime / Phobos
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 27 01:30:35 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20617
Issue ID: 20617
Summary: There is no support for copying hashmaps in Druntime /
Phobos
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
void main()
{
int[int] map1 = [1:1, 2:2, 3:3];
int[int] map2;
map2.copy(map1); // ?
}
-----
I am not asking for special syntax. Stuff like 'map2 = map1[]` would look cool,
but it's outside the scope here.
There should be `copy` functionality implemented somewhere in Druntime /
Phobos, it's not ideal that we have to write this code manually such as:
-----
map1.byKeyValue.each!(pair => map2[pair.key] = pair.value);
-----
--
More information about the Digitalmars-d-bugs
mailing list