Cartesian product of ranges?

bearophile bearophileHUGS at lycos.com
Wed Dec 14 12:50:53 PST 2011


Justin Whear:

> alias Tuple!(int, string) P;
> assert(equal( 
> 	cartesianProduct([1, 2], ["a", "b"]),
> 	[ P(1, "a"), P(1, "b"), P(2, "a"), P(2, "b") ]
> ));
> 

See std.range.lockstep and std.range.zip.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list