Truly lazy ranges, transient .front, and std.range.Generator
HaraldZealot via Digitalmars-d
digitalmars-d at puremagic.com
Tue Aug 18 13:47:40 PDT 2015
On Tuesday, 18 August 2015 at 19:37:47 UTC, Joseph Rushton
Wakeling wrote:
>
> Yes, broadly like your example, although note that your version
> won't handle multiple popFront() calls in succession without
> any .front call in-between.
Good point! And you show acceptable solution.
The last your example I prefer to parametrize with alias to
functions:
```d
mixin template LazyPopFront(alias frontImplementation, alias
popFrontImplementation)
...
```
It gives more flexibility.
One that worries me, if someone start to make odd things like
create shared instance of this range.
More information about the Digitalmars-d
mailing list