On 12/18/14 11:34 AM, Dicebot wrote:
On Thursday, 18 December 2014 at 16:15:09 UTC, Steven Schveighoffer wrote:

I don't disagree with the idea of having operators inside templates, I
just don't know if it solves the problem I was looking at.

Your original snippet seems to implementable within proposed DIP if you
replace struct with raw template. You will lose struct properties like
having actual instance but those don't exist for built-in tuples either.

So the discussion is here:

https://github.com/D-Programming-Language/druntime/pull/1070

Essentially, we want to implement a range which gives access to builtin-AA elements via a pair or tuple. The first element will be the key, the second the value.

But we also want to allow changing the value, and getting the key by reference (if, for instance, it's a huge struct).

The big issue here is that people are worried about putting in some 'hacky' type returned from 'front' for this range, when "builtin tuples are around the corner." We don't want to have people get used to having one API, and then have to switch to another API when real tuples are released.

So having an actual concrete instance is important here. 'front' doesn't return a type it returns a value tuple.

Oh, and we can't use std.typecons.Tuple because that's in Phobos, this is druntime.

(and my assertion is that front.key and front.value should work instead of having to use front[0] and front[1]!)

-Steve

Reply via email to