One other gotcha that I've run into is trying to use foreach on a
range of tuples with an iteration index. It does not do what you
might expect, try:
import std.range, std.stdio;
void main()
{
auto a = repeat(1,5);
auto b = repeat(2,5);
foreach(i, ab; a.zip(b)) writeln(i, " ", ab);
}
See bugzilla #5550 for bearophile's range.enumerate enhancement
request.