pop & popFront combined
    "Nordlöw" via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Nov  1 04:45:24 PDT 2014
    
    
  
On Saturday, 1 November 2014 at 11:43:28 UTC, Nordlöw wrote:
> if (!x.empty)
>     if (auto front = x.stealFront)
>     {
>         front.doStuff;
>     }
>
> This is more functional/atomic, that is it reduces the risk of 
> accidentally forgetting to call popFront at the end.
Forgot my explicit question:
So why isn't something like x.stealFront already in Phobos?
    
    
More information about the Digitalmars-d-learn
mailing list