Why is there no combination of popFront and front to pop? (aka Python `next`)

Marc Schütz via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Feb 17 09:58:00 PST 2016


On Wednesday, 17 February 2016 at 01:45:24 UTC, Rikki Cattermole 
wrote:
> On 17/02/16 1:19 PM, Seb wrote:
>> In any case such a next method would be very easy to implement 
>> (see
>> below) and thus I am wondering why it isn't part of phobos?
>>
>> ```
>> auto next(Range)(ref Range a){
>>      auto b = a.front;
>>      a.popFront();
>>      return b;
>> }
>>
>> ````
>>
>> Thanks for your input!
>
> Oh but there is: 
> http://dlang.org/phobos/std_range_primitives.html#.moveFront

`moveFront()` doesn't call `popFront()`.


More information about the Digitalmars-d-learn mailing list