opNext: Simplified ranges

Imperatorn johan_forsberg_86 at hotmail.com
Sun Nov 6 08:30:07 UTC 2022


On Sunday, 6 November 2022 at 07:55:13 UTC, Tomer at Weka wrote:
> On Sunday, 6 November 2022 at 01:48:04 UTC, Walter Bright wrote:
>> We didn't use the "next" protocol for ranges because one 
>> cannot test for existence of the next element without 
>> consuming it.
>
> But that's exactly the issue - I have to produce the element in 
> the range's ctor, which essentially requires a "non-popping 
> popNext" to determine if it's empty and assign the front
>
> -tomer

Doesn't one the solutions from Steven or Dukec work?


More information about the Digitalmars-d mailing list