Forward ranges in Phobos v2
Paul Backus
snarwin at gmail.com
Wed Nov 3 00:18:59 UTC 2021
On Wednesday, 3 November 2021 at 00:01:33 UTC, H. S. Teoh wrote:
> The problem with manually-added tags of this sort is that
> people forget to do it, and that leads to trouble. Preferably,
> it should be something already implicit in the range type
> itself, that does not require additional effort to tag.
>
> I'm kinda toying with the idea of struct == forward range,
> class == input range: the difference is inherent in the type
> itself and requires no further effort beyond the decision to
> use a by-value type vs. a by-reference type, which coincides
> with the decision to make something an input range or a forward
> range.
Having input ranges implement `next` and forward ranges implement
`head` and `tail` would also make them easy to distinguish.
More information about the Digitalmars-d
mailing list