bool_trait_def.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
  2. // Copyright Aleksey Gurtovoy 2002-2004
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // $Source$
  8. // $Date$
  9. // $Revision$
  10. //
  11. // This header is deprecated and no longer used by type_traits:
  12. //
  13. #if defined(__GNUC__) || defined(_MSC_VER)
  14. # pragma message("NOTE: Use of this header (bool_trait_def.hpp) is deprecated")
  15. #endif
  16. #include <boost/type_traits/detail/template_arity_spec.hpp>
  17. #include <boost/type_traits/integral_constant.hpp>
  18. #include <boost/config.hpp>
  19. //
  20. // Unfortunately some libraries have started using this header without
  21. // cleaning up afterwards: so we'd better undef the macros just in case
  22. // they've been defined already....
  23. //
  24. #ifdef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
  25. #undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
  26. #undef BOOST_TT_AUX_BOOL_C_BASE
  27. #undef BOOST_TT_AUX_BOOL_TRAIT_DEF1
  28. #undef BOOST_TT_AUX_BOOL_TRAIT_DEF2
  29. #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1
  30. #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2
  31. #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1
  32. #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2
  33. #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1
  34. #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2
  35. #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1
  36. #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2
  37. #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1
  38. #undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1
  39. #endif
  40. #ifndef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
  41. # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) /**/
  42. #endif
  43. #ifndef BOOST_TT_AUX_BOOL_C_BASE
  44. # define BOOST_TT_AUX_BOOL_C_BASE(C) : public ::boost::integral_constant<bool,C>
  45. #endif
  46. #define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \
  47. template< typename T > struct trait \
  48. BOOST_TT_AUX_BOOL_C_BASE(C) \
  49. { \
  50. public:\
  51. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  52. }; \
  53. \
  54. BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
  55. /**/
  56. #define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \
  57. template< typename T1, typename T2 > struct trait \
  58. BOOST_TT_AUX_BOOL_C_BASE(C) \
  59. { \
  60. public:\
  61. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  62. }; \
  63. \
  64. BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \
  65. /**/
  66. #define BOOST_TT_AUX_BOOL_TRAIT_DEF3(trait,T1,T2,T3,C) \
  67. template< typename T1, typename T2, typename T3 > struct trait \
  68. BOOST_TT_AUX_BOOL_C_BASE(C) \
  69. { \
  70. public:\
  71. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  72. }; \
  73. \
  74. BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(3,trait) \
  75. /**/
  76. #define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \
  77. template<> struct trait< sp > \
  78. BOOST_TT_AUX_BOOL_C_BASE(C) \
  79. { \
  80. public:\
  81. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  82. }; \
  83. /**/
  84. #define BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,sp1,sp2,C) \
  85. template<> struct trait< sp1,sp2 > \
  86. BOOST_TT_AUX_BOOL_C_BASE(C) \
  87. { \
  88. public:\
  89. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  90. }; \
  91. /**/
  92. #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \
  93. template<> struct trait##_impl< sp > \
  94. { \
  95. public:\
  96. BOOST_STATIC_CONSTANT(bool, value = (C)); \
  97. }; \
  98. /**/
  99. #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \
  100. template<> struct trait##_impl< sp1,sp2 > \
  101. { \
  102. public:\
  103. BOOST_STATIC_CONSTANT(bool, value = (C)); \
  104. }; \
  105. /**/
  106. #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(param,trait,sp,C) \
  107. template< param > struct trait< sp > \
  108. BOOST_TT_AUX_BOOL_C_BASE(C) \
  109. { \
  110. public:\
  111. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  112. }; \
  113. /**/
  114. #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,sp,C) \
  115. template< param1, param2 > struct trait< sp > \
  116. BOOST_TT_AUX_BOOL_C_BASE(C) \
  117. { \
  118. public:\
  119. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  120. }; \
  121. /**/
  122. #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
  123. template< param > struct trait< sp1,sp2 > \
  124. BOOST_TT_AUX_BOOL_C_BASE(C) \
  125. { \
  126. public:\
  127. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  128. }; \
  129. /**/
  130. #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(param1,param2,trait,sp1,sp2,C) \
  131. template< param1, param2 > struct trait< sp1,sp2 > \
  132. BOOST_TT_AUX_BOOL_C_BASE(C) \
  133. { \
  134. public:\
  135. BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
  136. }; \
  137. /**/
  138. #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
  139. template< param > struct trait##_impl< sp1,sp2 > \
  140. { \
  141. public:\
  142. BOOST_STATIC_CONSTANT(bool, value = (C)); \
  143. }; \
  144. /**/
  145. #ifndef BOOST_NO_CV_SPECIALIZATIONS
  146. # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
  147. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
  148. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const,value) \
  149. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp volatile,value) \
  150. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const volatile,value) \
  151. /**/
  152. #else
  153. # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
  154. BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
  155. /**/
  156. #endif