Should this work?
John Colvin
john.loughran.colvin at gmail.com
Fri Jan 10 13:00:50 PST 2014
On Friday, 10 January 2014 at 20:56:23 UTC, monarch_dodra wrote:
> On Friday, 10 January 2014 at 20:43:31 UTC, John Colvin wrote:
>> On Friday, 10 January 2014 at 20:33:29 UTC, monarch_dodra
>> wrote:
>>> On Friday, 10 January 2014 at 20:23:32 UTC, John Colvin wrote:
>>>> It's not ideal as full-speed performance depends on the Take
>>>> struct being optimised away, but there is always:
>>>>
>>>> auto blah = range.takeOne.front;
>>>
>>> What's that the point of writing that over:
>>> auto blah = range.front;
>>> ?
>>
>> oh... I thought the take functions advanced the range.
>
> Well, first, you'd have to actually *pop* said take range.
> Here, you are just building one, and taking its front, but not
> popping it. Second, the range would have to be an actual
> reference type, or you'd just be popping a copy of the
> original range. And still, that's if its not outright sliced.
>
> The inclusion of "takeOne" here seems not only useless, but
> potentially counterproductive to what we are trying to achieve.
I agree, my mistake.
More information about the Digitalmars-d
mailing list