Can't recreate a range?
Paul Backus
snarwin at gmail.com
Thu Apr 30 18:05:55 UTC 2020
On Thursday, 30 April 2020 at 16:21:05 UTC, Steven Schveighoffer
wrote:
> I would say part of the issue is that you are doing all your
> work in front and not popFront.
>
[...]
>
> I'd say:
>
> 1. move your work to the popFront function (you then need to
> call popFront once before returning the range in your factory
> method).
> 2. change empty to check if the buffer is empty instead of the
> input.
Doing work in popFront instead of front is usually an
anti-pattern, since it forces eager evaluation of the next
element even when that element is never used. You should only do
this if there's no reasonable way to avoid it.
More information about the Digitalmars-d-learn
mailing list