how to skip the next (n) item & continue from (n+1) with a range ? e.g. in File(fn).byLine();
mw
mingwu at gmail.com
Mon Jun 22 21:50:05 UTC 2020
On Monday, 22 June 2020 at 21:27:12 UTC, Steven Schveighoffer
wrote:
>> auto line = range.front;
>> range.popFront; // pop immediately
>
> This is a bad idea, once you popFront, the original front is
> possibly invalid (and technically is the case for byLine).
In this case, it's caused by underlying structure may reuse the
`byLine` buffer, but I'm asking a more general question about
range interface: why not provide an extra popAndReturnFront(),
and the user to choose in the actual usage scenario.
More information about the Digitalmars-d-learn
mailing list