2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-02 21:02:15 +00:00

[Sequence] Add the cartesian_product method

Also, replace the old tuple_cartesian_product by a newer, slightly
more efficient but much simpler version.
This commit is contained in:
Louis Dionne
2015-05-17 22:09:21 -04:00
parent 2870863039
commit 90ddffe54d
10 changed files with 422 additions and 227 deletions

View File

@@ -240,6 +240,36 @@ BOOST_HANA_CONSTANT_CHECK(
//////////////////////////////////////////////////////////////////////////////
{
//! [cartesian_product]
static_assert(
cartesian_product(
make_tuple(
make_tuple(1, 2, 3),
make_tuple('a', 'b'),
make_tuple(type<int>, type<char>)
)
) ==
make_tuple(
make_tuple(1, 'a', type<int>),
make_tuple(1, 'a', type<char>),
make_tuple(1, 'b', type<int>),
make_tuple(1, 'b', type<char>),
make_tuple(2, 'a', type<int>),
make_tuple(2, 'a', type<char>),
make_tuple(2, 'b', type<int>),
make_tuple(2, 'b', type<char>),
make_tuple(3, 'a', type<int>),
make_tuple(3, 'a', type<char>),
make_tuple(3, 'b', type<int>),
make_tuple(3, 'b', type<char>)
)
, "");
//! [cartesian_product]
}{
//! [group]
// without a predicate
BOOST_HANA_CONSTANT_CHECK(