Associative array for array of classes
Alberto Simon
lugaidster at gmail.com
Thu Apr 27 19:46:46 PDT 2006
You should use '(("3" in assoc) == null)' instead of '(assoc["3"] is null)'
Regards,
Alberto Simon
"Stewart Gordon" <smjg_1998 at yahoo.com> escribió en el mensaje
news:e2qh6d$1lfk$2 at digitaldaemon.com...
> clayasaurus wrote:
> <snip>
>> 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.
> <snip>
>
> That's strange. It should be an ArrayBoundsError.
>
> Stewart.
More information about the Digitalmars-d-learn
mailing list