-vgc Info ok?

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 19 04:15:11 PDT 2015


On Tuesday, 19 May 2015 at 09:43:06 UTC, Chris wrote:
> On Tuesday, 19 May 2015 at 09:10:50 UTC, Namespace wrote:
>> On Monday, 18 May 2015 at 14:30:43 UTC, Chris wrote:
>>> The following
>>>
>>> string[string] myarray = ["key":"value"];
>>> string entry;
>>> entry = myarray["key"]; // => vgc: indexing an associative 
>>> array may cause GC allocation
>>>
>>> Why is _accessing_ an assoc treated as indexing it?
>>
>> No error if you use myarray.get("key", null); or string* entry 
>> = "key" in myarray;
>
> What are the advantages / disadvantages of the two methods?

You could get null with "in" if your key is not there. Besides 
that, no disadvantages.


More information about the Digitalmars-d-learn mailing list