Re: AA initialization

2014-08-06 Thread Kozzi11 via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 14:40:00 UTC, Puming wrote: Thanks for your clarification (and also in the other thread), so this is an implementation issue for builtin AAs. https://issues.dlang.org/show_bug.cgi?id=10535

Re: AA initialization

2014-08-06 Thread via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 13:15:27 UTC, Kozzi11 wrote: AFAIK there is no easy way to do it. Maybe it would be fine to add some function to phobos. Something like this: auto initAA(VT,KT)() { static struct Entry { Entry *next; size_t hash;

Re: AA initialization

2014-08-06 Thread Puming via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 14:38:34 UTC, Marc Schütz wrote: On Wednesday, 6 August 2014 at 13:15:27 UTC, Kozzi11 wrote: AFAIK there is no easy way to do it. Maybe it would be fine to add some function to phobos. Something like this: auto initAA(VT,KT)() { static struct Entry

Re: AA initialization

2014-08-06 Thread Kozzi11 via Digitalmars-d-learn
On Wednesday, 6 August 2014 at 11:32:41 UTC, Puming wrote: I found AA initialization have a strange effect: ```d string[string] map; // same as `string[string] map = string[string].init; writeln(map); // output: [] string[string] refer = map; // make a reference

AA initialization

2014-08-06 Thread Puming via Digitalmars-d-learn
I found AA initialization have a strange effect: ```d string[string] map; // same as `string[string] map = string[string].init; writeln(map); // output: [] string[string] refer = map; // make a reference refer["1"] = "2"; // update the re