shared associative array initialization

japplegame japplegame at gmail.com
Sun May 13 09:25:39 PDT 2012


I have no idea how to simple initialize shared associative array.
This code compiled but causing access violation when running.

shared uint[char] arr;

shared static this() {
   // next expression seems wrong, because
   // arr is process related and ['a':1, 'b':2] is thread related
   // probably, should be implicit cast error
   arr = ['a':1, 'b':2];
   // this is okay, but too cumbersome
   arr['c'] = 3;
   arr['d'] = 4;
}

void main() {
}

DMD32 D Compiler v2.059 on Windows 7 64 bit


More information about the Digitalmars-d-learn mailing list