www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14598] New: range primitives for popFront+return front


          Issue ID: 14598
           Summary: range primitives for popFront+return front
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code dawg.eu

It is a constant nuisance that a trivial combined range operation is missing
from std.range as a convenient function.
In many situations this requires pretty verbose code.

if (someCondition)
    auto val = range.front;
    return val;

As such an operation would be used very often it seems reasonable to add them,
even though they are trivial.

I'd suggest frontPop and backPop as names.

May 17 2015