DIP67: Associative Ranges

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 28 23:59:08 PDT 2014


Brad Anderson:

> you rarely want
> to iterate through an associative array without having both the
> key and the value on hand.

This is very false. I have tons of cases where you only iterate 
on values or keys. On the other hand I have suggested several 
times that I'd like a byPairs (that yields keys-values tuple 
pairs).


> Doing byKey requires you to do a
> lookup to get the corresponding value which just takes up cycles
> unnecessarily.

Usually people use a "AA.byKey.zip(AA.byValue)" that is not 
reliable.

Bye,
bearophile


More information about the Digitalmars-d mailing list