how to iterate over an AA by key-value pair (tuple)?

bearophile bearophileHUGS at lycos.com
Thu Feb 13 16:22:38 PST 2014


timotheecour:

> is there anything more efficient than this?
>
> auto byKeyValue(T)(T a)if(isAssociativeArray!T){
>    return a.byKey.map!(b=>tuple(b, a[b]));
> }

zipping byKey and byValue could be faster, but there's no 
guarantee its result is correct.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list