DIP67: Associative Ranges

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 29 10:23:07 PDT 2014


On Wednesday, 29 October 2014 at 06:59:09 UTC, bearophile wrote:
> 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).
>

It happens to me too but it's very much a minority of uses. 
Having sets as well as maps would help replace some of these 
cases. Not all, of course.

>
>> 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.

Better than doing key lookups on every iteration but awfully ugly 
and should be unnecessary. byPairs sounds good.


More information about the Digitalmars-d mailing list