pop & popFront combined

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 1 06:39:01 PDT 2014


On Saturday, 1 November 2014 at 13:36:05 UTC, Marc Schütz wrote:
> On Saturday, 1 November 2014 at 13:30:16 UTC, anonymous wrote:
[...]
>>> auto ref stealFront(R)(ref R r)
>>> {
>>> import std.range: moveFront, popFront;
>>> auto e = r.moveFront;
>>> r.popFront;
>>> return e;
>>> }
[...]
> It's probably intended to mean `auto` + `ref`, not `auto ref`. 
> `ref` alone is already sufficient to get type deduction.

But ref is wrong. The function returns a local. Just auto would
be fine.


More information about the Digitalmars-d-learn mailing list