• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright 2017 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 #include <boost/mp11/detail/config.hpp>
10 
11 #if BOOST_MP11_MSVC
12 # pragma warning( disable: 4503 ) // decorated name length exceeded
13 #endif
14 
15 #include <boost/mp11/function.hpp>
16 #include <boost/mp11/algorithm.hpp>
17 #include <boost/mp11/list.hpp>
18 #include <boost/core/lightweight_test_trait.hpp>
19 #include <type_traits>
20 
main()21 int main()
22 {
23     using boost::mp11::mp_same;
24     using boost::mp11::mp_true;
25     using boost::mp11::mp_false;
26 
27     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<>, mp_true>));
28     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void>, mp_true>));
29     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void>, mp_true>));
30     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, void>, mp_true>));
31     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, void, void>, mp_true>));
32     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, void, void, void>, mp_true>));
33 
34     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, int>, mp_false>));
35     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, int>, mp_false>));
36     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, void, int>, mp_false>));
37     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_same<void, void, void, void, int>, mp_false>));
38 
39     using boost::mp11::mp_repeat_c;
40     using boost::mp11::mp_list;
41     using boost::mp11::mp_apply;
42 
43     int const N = 1024;
44 
45     using L = mp_repeat_c<mp_list<void>, N>;
46     using R = mp_apply<mp_same, L>;
47 
48     BOOST_TEST_TRAIT_TRUE((std::is_same<R, mp_true>));
49 
50     return boost::report_errors();
51 }
52