DIP67: Associative Ranges

Freddy via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 29 16:33:53 PDT 2014


On Wednesday, 29 October 2014 at 19:55:14 UTC, H. S. Teoh via
Digitalmars-d wrote:
> On Wed, Oct 29, 2014 at 06:40:50PM +0000, Freddy via 
> Digitalmars-d wrote:
>> On Wednesday, 29 October 2014 at 18:04:30 UTC, John Colvin 
>> wrote:
>> >On Wednesday, 29 October 2014 at 17:36:41 UTC, H. S. Teoh via
>> >Digitalmars-d wrote:
> [...]
>> >>I've submitted a PR for byPair before, but it was 
>> >>roadblocked by the
>> >>fact that people demand that it return std.typecons.Tuple, 
>> >>yet we're
>> >>not allowed to import Phobos in druntime. Other than this IMO
>> >>nitpicky issue, the code was already all ready to go many 
>> >>moons ago.
>> >>
>> >>
>> >>T
>> >
>> >Can byPair be implemented in phobos, or does it need to access
>> >private/package stuff in druntime?
>> 
>> I don't see why not,It could be put into std.range and accept a
>> generic associative range(which includes the build-in 
>> associative
>> array).
>
> And how would it be implemented in a way that is stable across 
> AA
> implementations?
>
>
> --T
in std.range
----
auto byKeyPair(R)(R r) if(isAssociativeRange!R){
	return zip(r.byKey,r.byValue);
}
----
Although it will not be possible for lazy associative ranges
because they don't allow iteration
b.t.w should I add this to by PR?


More information about the Digitalmars-d mailing list