Bug 14598 – range primitives for popFront+return front
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-17T21:02:00Z
Last change time
2016-04-05T00:18:26Z
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2015-05-17T21:02:14Z
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.