T[][T] -> [(k1, v1), ..., (k1, vn), ..., (kn, v1), ..., (kn, vn)]
Tobias Pankrath
tobias at pankrath.net
Thu Feb 13 04:24:38 PST 2014
- Previous message: T[][T] -> [(k1, v1), ..., (k1, vn), ..., (kn, v1), ..., (kn, vn)]
- Next message: T[][T] -> [(k1, v1), ..., (k1, vn), ..., (kn, v1), ..., (kn, vn)]
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
>> Is there any other way to create a range of simple (key,value)
>> pairs for the array, but needs to allocate (hash.keys return
>> an array of keys) and then again look up every key.
>
> import std.algorithm : zip;
> import std.traits : isAssociativeArray;
>
> auto byKeyValuePair(AA)(AA aa) if (isAssociativeArray!AA)
> {
> return zip(aa.byKey, aa.byValue);
> }
That byKey and byValue adhere to the same order is not backed up
by the documenation, I suppose?
- Previous message: T[][T] -> [(k1, v1), ..., (k1, vn), ..., (kn, v1), ..., (kn, vn)]
- Next message: T[][T] -> [(k1, v1), ..., (k1, vn), ..., (kn, v1), ..., (kn, vn)]
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Digitalmars-d-learn
mailing list