making a struct an inputRange with free functions

Johannes Loher johannes.loher at fg4f.de
Mon Apr 16 19:10:03 UTC 2018


Is there a way to do this? Here is a naive implementation:
https://run.dlang.io/is/JKvL80 .

It does not pass `isInputRange` (I think, because the free functions are
not visible in the scope of `isInputRange`).

Trying to iterate over it with a foreach loop results in a compile error:
Error: invalid foreach aggregate NoRange(0, 0).this(5), define
opApply(), range primitives, or use .tupleof

Thanks for your help!


More information about the Digitalmars-d-learn mailing list