]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_product.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / mp11 / test / mp_product.cpp
1
2 // Copyright 2015 Peter Dimov.
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 //
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
8
9
10 #include <boost/mp11/algorithm.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/utility.hpp>
13 #include <boost/core/lightweight_test_trait.hpp>
14 #include <type_traits>
15 #include <tuple>
16 #include <utility>
17
18 struct X1 {};
19 struct X2 {};
20 struct X3 {};
21
22 struct Y1 {};
23
24 struct Z1 {};
25 struct Z2 {};
26
27 template<class T1, class T2, class T3> struct F {};
28
29 template<class T> struct F1 {};
30
31 int main()
32 {
33 using boost::mp11::mp_list;
34 using boost::mp11::mp_product;
35 using boost::mp11::mp_product_q;
36 using boost::mp11::mp_quote;
37
38 {
39 using L1 = std::tuple<X1, X2, X3>;
40 using L2 = mp_list<Y1>;
41 using L3 = std::pair<Z1, Z2>;
42
43 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product<F, L1, L2, L3>, std::tuple<F<X1, Y1, Z1>, F<X1, Y1, Z2>, F<X2, Y1, Z1>, F<X2, Y1, Z2>, F<X3, Y1, Z1>, F<X3, Y1, Z2>>>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product_q<mp_quote<F>, L1, L2, L3>, std::tuple<F<X1, Y1, Z1>, F<X1, Y1, Z2>, F<X2, Y1, Z1>, F<X2, Y1, Z2>, F<X3, Y1, Z1>, F<X3, Y1, Z2>>>));
45 }
46
47 {
48 using L1 = std::tuple<X1, X2, X3>;
49 using L2 = mp_list<>;
50 using L3 = std::pair<Z1, Z2>;
51
52 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product<F, L1, L2, L3>, std::tuple<>>));
53 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product_q<mp_quote<F>, L1, L2, L3>, std::tuple<>>));
54 }
55
56 {
57 using L1 = std::tuple<X1, X2, X3>;
58 using L2 = mp_list<X1, X2, X3>;
59
60 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product<F1, L1>, std::tuple<F1<X1>, F1<X2>, F1<X3>>>));
61 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product_q<mp_quote<F1>, L1>, std::tuple<F1<X1>, F1<X2>, F1<X3>>>));
62
63 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product<F1, L2>, mp_list<F1<X1>, F1<X2>, F1<X3>>>));
64 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_product_q<mp_quote<F1>, L2>, mp_list<F1<X1>, F1<X2>, F1<X3>>>));
65 }
66
67 return boost::report_errors();
68 }