• 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 
10 #include <boost/mp11/bind.hpp>
11 #include <boost/mp11/utility.hpp>
12 #include <boost/core/lightweight_test_trait.hpp>
13 #include <type_traits>
14 
15 struct X1 {};
16 struct X2 {};
17 struct X3 {};
18 struct X4 {};
19 struct X5 {};
20 struct X6 {};
21 struct X7 {};
22 struct X8 {};
23 struct X9 {};
24 
25 template<class T> using add_pointer = typename std::add_pointer<T>::type;
26 
main()27 int main()
28 {
29     using namespace boost::mp11;
30 
31     using Q_addp = mp_quote<add_pointer>;
32 
33     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _1>::fn<X1>, X1*>));
34     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _1>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X1*>));
35 
36     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _2>::fn<X1, X2>, X2*>));
37     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _2>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X2*>));
38 
39     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _3>::fn<X1, X2, X3>, X3*>));
40     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _3>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X3*>));
41 
42     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _4>::fn<X1, X2, X3, X4>, X4*>));
43     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _4>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X4*>));
44 
45     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _5>::fn<X1, X2, X3, X4, X5>, X5*>));
46     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _5>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X5*>));
47 
48     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _6>::fn<X1, X2, X3, X4, X5, X6>, X6*>));
49     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _6>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X6*>));
50 
51     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _7>::fn<X1, X2, X3, X4, X5, X6, X7>, X7*>));
52     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _7>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X7*>));
53 
54     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _8>::fn<X1, X2, X3, X4, X5, X6, X7, X8>, X8*>));
55     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _8>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X8*>));
56 
57     BOOST_TEST_TRAIT_TRUE((std::is_same<mp_bind_q<Q_addp, _9>::fn<X1, X2, X3, X4, X5, X6, X7, X8, X9>, X9*>));
58 
59     //
60 
61     return boost::report_errors();
62 }
63