pointer_traits_pointer_test.cpp 1.0 KB

123456789101112131415161718192021222324252627282930
  1. /*
  2. Copyright 2017 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/core/pointer_traits.hpp>
  8. #include <boost/core/is_same.hpp>
  9. #include <boost/core/lightweight_test_trait.hpp>
  10. template<class T>
  11. struct P { };
  12. int main()
  13. {
  14. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<int*,
  15. boost::pointer_traits<int*>::pointer>));
  16. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<int>,
  17. boost::pointer_traits<P<int> >::pointer>));
  18. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void*,
  19. boost::pointer_traits<void*>::pointer>));
  20. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<void>,
  21. boost::pointer_traits<P<void> >::pointer>));
  22. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<const int*,
  23. boost::pointer_traits<const int*>::pointer>));
  24. BOOST_TEST_TRAIT_TRUE((boost::core::is_same<P<const int>,
  25. boost::pointer_traits<P<const int> >::pointer>));
  26. return boost::report_errors();
  27. }