File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1181,6 +1181,16 @@ pub trait Itertools: Iterator {
1181
1181
/// assert_eq!(multi_prod.next(), Some(vec![1, 3, 5]));
1182
1182
/// assert_eq!(multi_prod.next(), None);
1183
1183
/// ```
1184
+ ///
1185
+ /// If the adapted iterator is empty, the result is an iterator yielding a single empty vector.
1186
+ /// This is known as the [nullary cartesian product](https://en.wikipedia.org/wiki/Empty_product#Nullary_Cartesian_product).
1187
+ ///
1188
+ /// ```
1189
+ /// use itertools::Itertools;
1190
+ /// let mut nullary_cartesian_product = (0..0).map(|i| (i * 2)..(i * 2 + 2)).multi_cartesian_product();
1191
+ /// assert_eq!(nullary_cartesian_product.next(), Some(vec![]));
1192
+ /// assert_eq!(nullary_cartesian_product.next(), None);
1193
+ /// ```
1184
1194
#[ cfg( feature = "use_alloc" ) ]
1185
1195
fn multi_cartesian_product ( self ) -> MultiProduct < <Self :: Item as IntoIterator >:: IntoIter >
1186
1196
where
You can’t perform that action at this time.
0 commit comments