• 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_pop_back;
22 
23     using L1 = mp_list<void>;
24     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L1>, mp_list<>>));
25 
26     using L2 = mp_list<float, void, int[]>;
27     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L2>, mp_list<float, void>>));
28 
29     using L3 = std::tuple<int>;
30     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L3>, std::tuple<>>));
31 
32     using L4 = std::tuple<char, double>;
33     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L4>, std::tuple<char>>));
34 
35     using boost::mp11::mp_iota_c;
36     using boost::mp11::mp_size_t;
37 
38     int const N = 137;
39 
40     using L6 = mp_iota_c<N>;
41     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_pop_back<L6>, mp_iota_c<N-1>>));
42 
43     using boost::mp11::mp_valid;
44 
45     using L7 = mp_list<>;
46     BOOST_TEST_TRAIT_FALSE((mp_valid<mp_pop_back, L7>));
47 
48     return boost::report_errors();
49 }
50