• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/core/lightweight_test_trait.hpp>
11 #include <boost/mp11/list.hpp>
12 #include <boost/mp11/integral.hpp>
13 #include <type_traits>
14 #include <tuple>
15 #include <utility>
16 
main()17 int main()
18 {
19     using boost::mp11::mp_list;
20     using boost::mp11::mp_size;
21     using boost::mp11::mp_size_t;
22 
23     using L1 = mp_list<>;
24     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L1>, mp_size_t<0>>));
25 
26     using L2 = mp_list<void>;
27     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L2>, mp_size_t<1>>));
28 
29     using L3 = mp_list<int[], void, float>;
30     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L3>, mp_size_t<3>>));
31 
32     using L4 = std::tuple<>;
33     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L4>, mp_size_t<0>>));
34 
35     using L5 = std::tuple<int>;
36     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L5>, mp_size_t<1>>));
37 
38     using L6 = std::tuple<int, int>;
39     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L6>, mp_size_t<2>>));
40 
41     using L7 = std::pair<char, double>;
42     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L7>, mp_size_t<2>>));
43 
44     using L8 = std::add_const<void()>;
45     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_size<L8>, mp_size_t<1>>));
46 
47     return boost::report_errors();
48 }
49