is_const_test.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // (C) Copyright John Maddock 2000.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifdef TEST_STD
  6. # include <type_traits>
  7. #else
  8. # include <boost/type_traits/is_const.hpp>
  9. #endif
  10. #include "test.hpp"
  11. #include "check_integral_constant.hpp"
  12. TT_TEST_BEGIN(is_const)
  13. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<void>::value, false);
  14. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const void>::value, true);
  15. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<test_abc1>::value, false);
  16. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const test_abc1>::value, true);
  17. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<int>::value, false);
  18. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const int>::value, true);
  19. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const UDT>::value, true);
  20. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const volatile UDT>::value, true);
  21. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const int&>::value, false);
  22. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
  23. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const int&&>::value, false);
  24. #endif
  25. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<cr_type>::value, false);
  26. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<incomplete_type>::value, false);
  27. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<foo0_t>::value, false);
  28. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const int[2]>::value, true);
  29. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<int[2]>::value, false);
  30. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<volatile int[2]>::value, false);
  31. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const volatile int[2]>::value, true);
  32. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const volatile int[]>::value, true);
  33. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<volatile int[]>::value, false);
  34. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<const int[]>::value, true);
  35. BOOST_CHECK_INTEGRAL_CONSTANT(::tt::is_const<int[]>::value, false);
  36. TT_TEST_END