mp_identity.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2015 Peter Dimov.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. //
  5. // See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt
  7. #include <boost/mp11/utility.hpp>
  8. #include <boost/core/lightweight_test_trait.hpp>
  9. #include <type_traits>
  10. struct X {};
  11. int main()
  12. {
  13. using boost::mp11::mp_identity;
  14. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity<void const volatile>::type, void const volatile>));
  15. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity<void()>::type, void()>));
  16. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity<int const[]>::type, int const[]>));
  17. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity<X>::type, X>));
  18. using boost::mp11::mp_identity_t;
  19. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity_t<void const volatile>, void const volatile>));
  20. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity_t<void()>, void()>));
  21. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity_t<int const[]>, int const[]>));
  22. BOOST_TEST_TRAIT_TRUE((std::is_same<mp_identity_t<X>, X>));
  23. return boost::report_errors();
  24. }