https://issues.dlang.org/show_bug.cgi?id=15357
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from [email protected] --- I think each should mirror the behavior of foreach. Give it a range that returns one element, and the first variable is interpreted as an index. Give it a range that returns two elements, and each variable is one of those elements. unittest { import std.range, std.algorithm, std.stdio; auto a = [ 'a', 'b', 'c' ]; auto b = [ 'd', 'e', 'f' ]; // print each character with an index foreach(i, c ; a) writeln(i, " : ", c); a.each!((i, c) => writeln(i, " : ", c)); // print pairs of characters foreach(c1, c2 ; a.lockstep(b)) writeln(c1, " : ", c2); a.lockstep(b).each!((c1, c2) => writeln(c1, " : ", c2)); } --
