.byKeyValue should probably return a Tuple

Seb via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 15 14:02:01 PST 2017


On Wednesday, 15 February 2017 at 21:54:20 UTC, Yuxuan Shui wrote:
> for(k, v; aa) { ... } is better than:
>
> for(o; aa) {
>     auto k = o.key, v = o.value;
>     ...
> }
>
> right?
>
> Are there any reason why .byKeyValue doesn't return a Tuple?

There's byPair (http://dlang.org/phobos/std_array.html#byPair) 
that as a library does exactly the following:

```
a.byKeyValue.map!(pair => tuple(pair.key, pair.value))
```


More information about the Digitalmars-d mailing list