[Issue 14598] New: range primitives for popFront+return front

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 17 14:02:14 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14598

          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 at puremagic.com
          Reporter: code at 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;
    range.popFront;
    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.

--


More information about the Digitalmars-d-bugs mailing list