On Saturday, 1 November 2014 at 13:22:34 UTC, Nordlöw wrote:
On Saturday, 1 November 2014 at 11:45:25 UTC, Nordlöw wrote:
So why isn't something like x.stealFront already in Phobos?

First try here:

https://github.com/nordlow/justd/blob/master/range_ex.d#L14

Please comment!

That is:

auto ref stealFront(R)(ref R r)
{
import std.range: moveFront, popFront;
auto e = r.moveFront;
r.popFront;
return e;
}

`auto ref` is nonsense here. You can't return a reference to `e`
as
it's a local variable.

Reply via email to