Associative array for array of classes
clayasaurus
clayasaurus at gmail.com
Wed Apr 26 21:49:07 PDT 2006
Ok, for basic types I know I can use
int[char[]] assoc;
assoc["3"] = 3;
And for classes I can do.
Class[char[]] assoc;
assoc["3"] = new Class;
Now, lets say I want to test if assoc["3"] has already been initialized
before I allocate it, but testing it with
if (assoc["3"] is null)
assoc["3"] = new Class;
I get a seg fault. Any other way to do this? File attached to better
illustrate my problem. Thanks.
~ Clay
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.d
Url: http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20060426/f0a5b3fc/attachment.diff
More information about the Digitalmars-d-learn
mailing list