On Monday, 2 July 2012 at 16:49:06 UTC, Joseph Rushton Wakeling wrote:
On 02/07/12 17:48, Timon Gehr wrote:
What would be your expected output?

I'd expect to see

0     5
1     4
2     3
3     2
4     1
5     0

i.e. as if I was foreach-ing over an array with the same values in inverted order.

Use the .array() property:

auto Range(alias func, Args...)(Args args) {
        return func(args).array();
}

void main() {}
        double[] ad = [ 0, 1, 2, 3, 4, 5 ];

        foreach(index, x; Range!(retro)(ad)) {
                writeln(index, "\t", x);
        }
}

Reply via email to