Ranges: is it ok if front is a data member?

bearophile bearophileHUGS at lycos.com
Thu Dec 12 08:40:17 PST 2013


Adam D. Ruppe:

> Consider the following:
>
> struct JustZeroes {
>     int front = 0;
>     enum bool = false;
>     void popFront() {}
> }
>
> Is that guaranteed to work as an input range?

It seems similar to 0.repeat

When you are not sure add a static assert below the range, to 
verify it is the kind of range you want.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list