]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_product.cpp
2 // Copyright 2015 Peter Dimov.
4 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
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>
27 template<class T1
, class T2
, class T3
> struct F
{};
29 template<class T
> struct F1
{};
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
;
39 using L1
= std::tuple
<X1
, X2
, X3
>;
40 using L2
= mp_list
<Y1
>;
41 using L3
= std::pair
<Z1
, Z2
>;
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
>>>));
48 using L1
= std::tuple
<X1
, X2
, X3
>;
50 using L3
= std::pair
<Z1
, Z2
>;
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
<>>));
57 using L1
= std::tuple
<X1
, X2
, X3
>;
58 using L2
= mp_list
<X1
, X2
, X3
>;
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
>>>));
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
>>>));
67 return boost::report_errors();