On Monday, 15 December 2014 at 14:41:43 UTC, bearophile wrote:
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
Ok. Thanks.
Is
Tuple!(Key,Value)[] pairs(Key,Value)(Value[Key] aa);
a suitable contender for now?
I especially wonder about the mutability of parameter aa.
BTW: Why doesn't aa.byKey.map work?