]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/example/cartesian_product.cpp
ee088541b03768e36a1ceb66915cf8beac3f0c2f
[ceph.git] / ceph / src / boost / libs / hana / example / cartesian_product.cpp
1 // Copyright Louis Dionne 2013-2016
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
4
5 #include <boost/hana/cartesian_product.hpp>
6 #include <boost/hana/equal.hpp>
7 #include <boost/hana/tuple.hpp>
8 #include <boost/hana/type.hpp>
9 namespace hana = boost::hana;
10
11
12 constexpr auto tuples = hana::make_tuple(
13 hana::make_tuple(1, 2, 3),
14 hana::make_tuple('a', 'b'),
15 hana::make_tuple(hana::type_c<int>, hana::type_c<char>)
16 );
17
18 constexpr auto prod = hana::make_tuple(
19 hana::make_tuple(1, 'a', hana::type_c<int>),
20 hana::make_tuple(1, 'a', hana::type_c<char>),
21 hana::make_tuple(1, 'b', hana::type_c<int>),
22 hana::make_tuple(1, 'b', hana::type_c<char>),
23
24 hana::make_tuple(2, 'a', hana::type_c<int>),
25 hana::make_tuple(2, 'a', hana::type_c<char>),
26 hana::make_tuple(2, 'b', hana::type_c<int>),
27 hana::make_tuple(2, 'b', hana::type_c<char>),
28
29 hana::make_tuple(3, 'a', hana::type_c<int>),
30 hana::make_tuple(3, 'a', hana::type_c<char>),
31 hana::make_tuple(3, 'b', hana::type_c<int>),
32 hana::make_tuple(3, 'b', hana::type_c<char>)
33 );
34
35 static_assert(hana::cartesian_product(tuples) == prod, "");
36
37 int main() { }