Initializing associative arrays

Tydr Schnubbis fake at address.dude
Mon May 1 11:29:58 PDT 2006


If I've got this array:

char[][][char[]] arr;

and want to initialize it, what do I do?  I couldn't make the 
initializer syntax work, I tried this:

arr = [["key1"]: ["one", "two"]];

Then I resorted to this:

static this() {
     arr["key1"] = split("one two");
}

And that works, but doesn't strike me as particularly obvious or 
practical.  It's a lot like the string list initializer trick I often 
use in python code.

Have I overlooked something here? Or maybe static initializers just 
aren't the right way to go for hashes?



More information about the Digitalmars-d-learn mailing list