copy_cv_ref_test.cpp 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. Copyright 2019 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License,
  5. Version 1.0. (See accompanying file LICENSE_1_0.txt
  6. or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifdef TEST_STD
  9. #include <type_traits>
  10. #else
  11. #include <boost/type_traits/copy_cv_ref.hpp>
  12. #endif
  13. #include "test.hpp"
  14. #include "check_type.hpp"
  15. TT_TEST_BEGIN(copy_cv_ref)
  16. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char>::type, int);
  17. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char>::type, const int);
  18. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char>::type, volatile int);
  19. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char>::type, const volatile int);
  20. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char&>::type, int&);
  21. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char&>::type, const int&);
  22. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char&>::type, volatile int&);
  23. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char&>::type, const volatile int&);
  24. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char>::type, const int);
  25. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char>::type, const int);
  26. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char>::type, const volatile int);
  27. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char>::type, const volatile int);
  28. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char&>::type, const int&);
  29. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char&>::type, const int&);
  30. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char&>::type, const volatile int&);
  31. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char&>::type, const volatile int&);
  32. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char>::type, volatile int);
  33. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char>::type, const volatile int);
  34. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char>::type, volatile int);
  35. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char>::type, const volatile int);
  36. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char&>::type, volatile int&);
  37. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char&>::type, const volatile int&);
  38. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char&>::type, volatile int&);
  39. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char&>::type, const volatile int&);
  40. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char>::type, const volatile int);
  41. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char>::type, const volatile int);
  42. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char>::type, const volatile int);
  43. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char>::type, const volatile int);
  44. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char&>::type, const volatile int&);
  45. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char&>::type, const volatile int&);
  46. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char&>::type, const volatile int&);
  47. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char&>::type, const volatile int&);
  48. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char>::type, int&);
  49. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char>::type, int&);
  50. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char>::type, int&);
  51. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char>::type, int&);
  52. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char&>::type, int&);
  53. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char&>::type, int&);
  54. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char&>::type, int&);
  55. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char&>::type, int&);
  56. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char>::type, const int&);
  57. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char>::type, const int&);
  58. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char>::type, const int&);
  59. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char>::type, const int&);
  60. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char&>::type, const int&);
  61. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char&>::type, const int&);
  62. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char&>::type, const int&);
  63. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char&>::type, const int&);
  64. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char>::type, volatile int&);
  65. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char>::type, volatile int&);
  66. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char>::type, volatile int&);
  67. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char>::type, volatile int&);
  68. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char&>::type, volatile int&);
  69. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char&>::type, volatile int&);
  70. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char&>::type, volatile int&);
  71. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char&>::type, volatile int&);
  72. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char>::type, const volatile int&);
  73. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char>::type, const volatile int&);
  74. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char>::type, const volatile int&);
  75. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char>::type, const volatile int&);
  76. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char&>::type, const volatile int&);
  77. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char&>::type, const volatile int&);
  78. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char&>::type, const volatile int&);
  79. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char&>::type, const volatile int&);
  80. #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  81. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, char&&>::type, int&&);
  82. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const char&&>::type, const int&&);
  83. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, volatile char&&>::type, volatile int&&);
  84. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int, const volatile char&&>::type, const volatile int&&);
  85. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, char&&>::type, const int&&);
  86. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const char&&>::type, const int&&);
  87. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, volatile char&&>::type, const volatile int&&);
  88. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int, const volatile char&&>::type, const volatile int&&);
  89. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, char&&>::type, volatile int&&);
  90. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const char&&>::type, const volatile int&&);
  91. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, volatile char&&>::type, volatile int&&);
  92. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int, const volatile char&&>::type, const volatile int&&);
  93. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, char&&>::type, const volatile int&&);
  94. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const char&&>::type, const volatile int&&);
  95. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, volatile char&&>::type, const volatile int&&);
  96. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int, const volatile char&&>::type, const volatile int&&);
  97. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, char&&>::type, int&);
  98. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const char&&>::type, int&);
  99. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, volatile char&&>::type, int&);
  100. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&, const volatile char&&>::type, int&);
  101. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, char&&>::type, const int&);
  102. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const char&&>::type, const int&);
  103. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, volatile char&&>::type, const int&);
  104. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&, const volatile char&&>::type, const int&);
  105. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, char&&>::type, volatile int&);
  106. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const char&&>::type, volatile int&);
  107. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, volatile char&&>::type, volatile int&);
  108. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&, const volatile char&&>::type, volatile int&);
  109. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, char&&>::type, const volatile int&);
  110. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const char&&>::type, const volatile int&);
  111. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, volatile char&&>::type, const volatile int&);
  112. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&, const volatile char&&>::type, const volatile int&);
  113. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char>::type, int&&);
  114. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char>::type, int&&);
  115. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char>::type, int&&);
  116. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char>::type, int&&);
  117. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char&>::type, int&);
  118. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char&>::type, int&);
  119. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char&>::type, int&);
  120. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char&>::type, int&);
  121. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, char&&>::type, int&&);
  122. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const char&&>::type, int&&);
  123. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, volatile char&&>::type, int&&);
  124. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<int&&, const volatile char&&>::type, int&&);
  125. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char>::type, const int&&);
  126. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char>::type, const int&&);
  127. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char>::type, const int&&);
  128. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char>::type, const int&&);
  129. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char&>::type, const int&);
  130. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char&>::type, const int&);
  131. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char&>::type, const int&);
  132. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char&>::type, const int&);
  133. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, char&&>::type, const int&&);
  134. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const char&&>::type, const int&&);
  135. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, volatile char&&>::type, const int&&);
  136. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const int&&, const volatile char&&>::type, const int&&);
  137. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char>::type, volatile int&&);
  138. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char>::type, volatile int&&);
  139. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char>::type, volatile int&&);
  140. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char>::type, volatile int&&);
  141. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char&>::type, volatile int&);
  142. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char&>::type, volatile int&);
  143. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char&>::type, volatile int&);
  144. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char&>::type, volatile int&);
  145. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, char&&>::type, volatile int&&);
  146. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const char&&>::type, volatile int&&);
  147. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, volatile char&&>::type, volatile int&&);
  148. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<volatile int&&, const volatile char&&>::type, volatile int&&);
  149. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char>::type, const volatile int&&);
  150. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char>::type, const volatile int&&);
  151. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char>::type, const volatile int&&);
  152. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char>::type, const volatile int&&);
  153. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char&>::type, const volatile int&);
  154. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char&>::type, const volatile int&);
  155. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char&>::type, const volatile int&);
  156. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char&>::type, const volatile int&);
  157. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, char&&>::type, const volatile int&&);
  158. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const char&&>::type, const volatile int&&);
  159. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, volatile char&&>::type, const volatile int&&);
  160. BOOST_CHECK_TYPE3(::tt::copy_cv_ref<const volatile int&&, const volatile char&&>::type, const volatile int&&);
  161. #endif
  162. TT_TEST_END