foreach(r; requests) { r.concider(); }

bearophile bearophileHUGS at lycos.com
Wed Oct 12 01:46:50 PDT 2011


Gor Gyolchanyan:

> 4. Allow foreach loops with a single iterator to be specified without
> a body, in which case it would return an input range (or some other
> type of range), lazily evaluating and returning the iterator.
>     void printRange(Range)(Range range) { foreach(r, range) {  writeln(r); } };
>     unittest { printRange(foreach(i; 0..100)); }

Is this the same?

unittest { printRange(std.range.iota(100)); }

Bye,
bearophile


More information about the Digitalmars-d mailing list