Cannot initialize associative array.

Ali Çehreli acehreli at yahoo.com
Tue Jun 22 15:30:40 PDT 2010


dcoder wrote:

 > So, I moved the initialization to inside the main function, and now 
it works.
 > Great.  I think we need to put this question in the FAQ.

For future reference, if it really needs to be global:

uint[string] mywords;

static this()
{
     mywords = [ "Hello" : 1, "World" : 1, "Cat" : 1, "Dog" : 1 ];
}

Ali


More information about the Digitalmars-d-learn mailing list