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 <type_traits>
13 #include <tuple>
14 #include <utility>
15
main()16 int main()
17 {
18 using boost::mp11::mp_list;
19 using boost::mp11::mp_push_back;
20
21 using L1 = mp_list<>;
22 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L1>, mp_list<>>));
23 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L1, char[1]>, mp_list<char[1]>>));
24 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L1, char[1], char[2]>, mp_list<char[1], char[2]>>));
25
26 using L2 = mp_list<void>;
27 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L2>, mp_list<void>>));
28 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L2, char[1]>, mp_list<void, char[1]>>));
29 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L2, char[1], char[2]>, mp_list<void, char[1], char[2]>>));
30
31 using L3 = mp_list<int[], void, float>;
32 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L3>, mp_list<int[], void, float>>));
33 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L3, char[1]>, mp_list<int[], void, float, char[1]>>));
34 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L3, char[1], char[2]>, mp_list<int[], void, float, char[1], char[2]>>));
35
36 using L4 = std::tuple<>;
37 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L4>, std::tuple<>>));
38 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L4, char>, std::tuple<char>>));
39 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L4, char, wchar_t>, std::tuple<char, wchar_t>>));
40
41 using L5 = std::tuple<int>;
42 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L5>, std::tuple<int>>));
43 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L5, char>, std::tuple<int, char>>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L5, char, wchar_t>, std::tuple<int, char, wchar_t>>));
45
46 using L6 = std::tuple<int, int>;
47 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L6>, std::tuple<int, int>>));
48 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L6, char>, std::tuple<int, int, char>>));
49 BOOST_TEST_TRAIT_TRUE((std::is_same<mp_push_back<L6, char, wchar_t>, std::tuple<int, int, char, wchar_t>>));
50
51 return boost::report_errors();
52 }
53