]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mp11/test/mp_quote_trait.cpp
2 // Copyright 2015, 2017 Peter Dimov.
4 // Distributed under the Boost Software License, Version 1.0.
6 // See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt
10 #include <boost/mp11/utility.hpp>
11 #include <boost/core/lightweight_test_trait.hpp>
12 #include <type_traits>
16 using boost::mp11::mp_identity
;
17 using boost::mp11::mp_quote_trait
;
18 using boost::mp11::mp_invoke
;
21 using Q
= mp_quote_trait
<mp_identity
>;
23 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<void>, void>));
24 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<int[]>, int[]>));
26 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, void>, void>));
27 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, int[]>, int[]>));
31 using Q
= mp_quote_trait
<std::add_pointer
>;
33 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<void>, void*>));
34 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<int[]>, int(*)[]>));
36 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, void>, void*>));
37 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, int[]>, int(*)[]>));
41 using Q
= mp_quote_trait
<std::add_const
>;
43 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<void>, void const>));
44 BOOST_TEST_TRAIT_TRUE((std::is_same
<Q::fn
<int[]>, int const[]>));
46 #if !BOOST_WORKAROUND( BOOST_GCC, < 40900 )
48 // g++ 4.7, 4.8 have difficulties with preserving top-level const
50 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, void>, void const>));
51 BOOST_TEST_TRAIT_TRUE((std::is_same
<mp_invoke
<Q
, int[]>, int const[]>));
56 return boost::report_errors();