Asssociative Array by Key-Value-Pair

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 15 06:41:41 PST 2014


Nordlöw:

> Is there a combined property of AAs that combine keys and 
> values typically
>
> .pairs()
>
> or
>
> .byPairs()
>
> I need to sort the elements of an AA by value and then 
> retrieved corresponding keys in the order sorted.

You can add an eager pairs() function to Phobos that returns an 
array of tuples.

byPairs can't be done in object.d for the dependency from tuples 
that aren't yet (and perhaps never) built-in in D, and it can't 
be done in Phobos because it needs access to unspecified runtime 
functions.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list