Joseph Rushton Wakeling:
double[] a = [ 0, 1, 2, 3, 4, 5 ];
foreach(i, x; retro(a))
writeln(i, "\t", x);
It's not a bug, it's caused by how ranges like retro work. retro
yields a single item. In D you can't overload on return values,
so foreach can't try to call a second retro.front overload that
yields an (index,item) tuple (that later foreach is able to
unpack on the fly) instead of the retro.front that just yields
the item.
To solve that problem this is what I have suggested to add to
Phobos:
http://d.puremagic.com/issues/show_bug.cgi?id=5550
Bye,
bearophile