-vgc Info ok?

Chris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 19 02:43:05 PDT 2015


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?


More information about the Digitalmars-d-learn mailing list