[Issue 20617] There is no support for copying hashmaps in Druntime / Phobos

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 5 03:46:58 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=20617

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich at gmail.com> ---
Never mind, I found a better way:

-----
import std.array;

void main()
{
    int[int] map1 = [1:1, 2:2, 3:3];
    int[int] map2 = assocArray(map1.byPair());
}
-----

Perhaps this should be added to the docs if it's not already there.

--


More information about the Digitalmars-d-bugs mailing list