Tuple representing elements of the
cartesian product of the given ranges.
auto cartesianProduct(R1, R2)(R1 range1, R2 range2) if (!allSatisfy!(isForwardRange, R1, R2) ||
anySatisfy!(isInfinite, R1, R2))Lazily computes the Cartesian product of two or more ranges. The product is a range of tuples of elements from each respective range.
The conditions for the two-range case are as follows:
If both ranges are finite, then one must be (at least) a
forward range and theother an input range.
If one range is infinite and the other finite, then the finite range must be a forward range, and the infinite range can be an input range.
If both ranges are infinite, then both must be forward ranges.
When there are more than two ranges, the above conditions apply to each adjacent pair of ranges.
range1 | The first range |
range2 | The second range |
ranges | Two or more non-infinite forward ranges |
otherRanges | Zero or more non-infinite forward ranges |
Tuple representing elements of the
cartesian product of the given ranges.
auto cartesianProduct(RR...)(RR ranges) if (ranges.length >= 2 &&
allSatisfy!(isForwardRange, RR) &&
!anySatisfy!(isInfinite, RR))ditto
auto cartesianProduct(R1, R2, RR...)(R1 range1, R2 range2, RR otherRanges) if (!allSatisfy!(isForwardRange, R1, R2, RR) ||
anySatisfy!(isInfinite, R1, R2, RR))ditto