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.