View source code
							
							
						
								Display the source code in std/algorithm/setops.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function std.algorithm.setops.cartesianProduct
Lazily computes the Cartesian product of two or more ranges. The product is a range of tuples of elements from each respective range.
						
				auto cartesianProduct(R1, R2)
				(
				
				  R1 range1,
				
				  R2 range2
				
				)
				
				if (!allSatisfy!(isForwardRange, R1, R2) || anySatisfy!(isInfinite, R1, R2));
				
				
				auto cartesianProduct(RR...)
				(
				
				  RR ranges
				
				)
				
				if (ranges
				
				auto cartesianProduct(R1, R2, RR...)
				(
				
				  R1 range1,
				
				  R2 range2,
				
				  RR otherRanges
				
				)
				
				if (!allSatisfy!(isForwardRange, R1, R2, RR) || anySatisfy!(isInfinite, R1, R2, RR));
						
					
				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 the other 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.
Parameters
| Name | Description | 
|---|---|
| range1 | The first range | 
| range2 | The second range | 
| ranges | Two or more non-infinite forward ranges | 
| otherRanges | Zero or more non-infinite forward ranges | 
Returns
A forward range of Tuple representing elements of the
    cartesian product of the given ranges.
Example
import stdExample
import stdExample
import stdAuthors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.