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.
Comment #1 by k.hara.pg — 2015-06-05T01:22:47Z
This is D2 Phobos enhancement.
Comment #2 by jack — 2016-04-05T00:18:26Z
Marking as won't fix because of the discussion here: https://github.com/D-Programming-Language/phobos/pull/4010 Most agree that it's not a good idea.