Fastest Way of Accessing Entries in an AA
"Nordlöw" via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 8 07:59:10 PST 2015
On Thursday, 8 January 2015 at 15:49:46 UTC, Dragos Carp wrote:
> On Thursday, 8 January 2015 at 15:45:27 UTC, Nordlöw wrote:
>> Is
>>
>> key in aa ? aa[key] : ValueType.init;
>>
>> the most efficient way to maybe return a value from an
>> associative array aa?
>
> aa.get(key, ValueType.init)
That was too easy ;)
It would be nice if the compiler could detect usage of aa.get()
automatically and issue either a diagnostics or transform it in
an optimization pass.
More information about the Digitalmars-d-learn
mailing list