http://d.puremagic.com/issues/show_bug.cgi?id=6788
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|DUPLICATE | --- Comment #3 from [email protected] 2013-02-07 10:03:25 PST --- (In reply to comment #2) > This is the same as the cartesianProduct of two ranges, which is already > checked into git HEAD. > > *** This issue has been marked as a duplicate of issue 7128 *** See this test code: import std.stdio, std.algorithm; void main() { auto data = [1, 2, 3, 4]; foreach (xy; cartesianProduct(data, data)) writeln(xy); } Tuple!(int, int)(1, 1) Tuple!(int, int)(2, 1) Tuple!(int, int)(3, 1) Tuple!(int, int)(4, 1) Tuple!(int, int)(1, 2) Tuple!(int, int)(2, 2) Tuple!(int, int)(3, 2) Tuple!(int, int)(4, 2) Tuple!(int, int)(1, 3) Tuple!(int, int)(2, 3) Tuple!(int, int)(3, 3) Tuple!(int, int)(4, 3) Tuple!(int, int)(1, 4) Tuple!(int, int)(2, 4) Tuple!(int, int)(3, 4) Tuple!(int, int)(4, 4) import std.stdio, std.range; void main() { auto data = [1, 2, 3, 4]; foreach (tup; pairwise(data)) writeln(tup); } Should print: Tuple!(int,int)(1, 2) Tuple!(int,int)(1, 3) Tuple!(int,int)(1, 4) Tuple!(int,int)(2, 3) Tuple!(int,int)(2, 4) Tuple!(int,int)(3, 4) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
