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