annotate DEPENDENCIES/generic/include/boost/type_traits/detail/bool_trait_def.hpp @ 50:fdc60bb03d1b

Subrepo state
author Chris Cannam
date Thu, 07 Aug 2014 19:19:27 +0100
parents 2665513ce2d3
children c530137014c0
rev   line source
Chris@16 1
Chris@16 2 // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION
Chris@16 3
Chris@16 4 // Copyright Aleksey Gurtovoy 2002-2004
Chris@16 5 //
Chris@16 6 // Distributed under the Boost Software License, Version 1.0.
Chris@16 7 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 8 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9
Chris@16 10 // $Source$
Chris@16 11 // $Date: 2011-10-09 15:28:33 -0700 (Sun, 09 Oct 2011) $
Chris@16 12 // $Revision: 74865 $
Chris@16 13
Chris@16 14 #include <boost/type_traits/detail/template_arity_spec.hpp>
Chris@16 15 #include <boost/type_traits/integral_constant.hpp>
Chris@16 16 #include <boost/mpl/bool.hpp>
Chris@16 17 #include <boost/mpl/aux_/lambda_support.hpp>
Chris@16 18 #include <boost/config.hpp>
Chris@16 19
Chris@16 20 //
Chris@16 21 // Unfortunately some libraries have started using this header without
Chris@16 22 // cleaning up afterwards: so we'd better undef the macros just in case
Chris@16 23 // they've been defined already....
Chris@16 24 //
Chris@16 25 #ifdef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
Chris@16 26 #undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
Chris@16 27 #undef BOOST_TT_AUX_BOOL_C_BASE
Chris@16 28 #undef BOOST_TT_AUX_BOOL_TRAIT_DEF1
Chris@16 29 #undef BOOST_TT_AUX_BOOL_TRAIT_DEF2
Chris@16 30 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1
Chris@16 31 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2
Chris@16 32 #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1
Chris@16 33 #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2
Chris@16 34 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1
Chris@16 35 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2
Chris@16 36 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1
Chris@16 37 #undef BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2
Chris@16 38 #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1
Chris@16 39 #undef BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1
Chris@16 40 #endif
Chris@16 41
Chris@16 42 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x570)
Chris@16 43 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 44 typedef ::boost::integral_constant<bool,C> type; \
Chris@16 45 enum { value = type::value }; \
Chris@16 46 /**/
Chris@16 47 # define BOOST_TT_AUX_BOOL_C_BASE(C)
Chris@16 48
Chris@16 49 #elif defined(BOOST_MSVC) && BOOST_MSVC < 1300
Chris@16 50
Chris@16 51 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 52 typedef ::boost::integral_constant<bool,C> base_; \
Chris@16 53 using base_::value; \
Chris@16 54 /**/
Chris@16 55
Chris@16 56 #endif
Chris@16 57
Chris@16 58 #ifndef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL
Chris@16 59 # define BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) /**/
Chris@16 60 #endif
Chris@16 61
Chris@16 62 #ifndef BOOST_TT_AUX_BOOL_C_BASE
Chris@16 63 # define BOOST_TT_AUX_BOOL_C_BASE(C) : public ::boost::integral_constant<bool,C>
Chris@16 64 #endif
Chris@16 65
Chris@16 66
Chris@16 67 #define BOOST_TT_AUX_BOOL_TRAIT_DEF1(trait,T,C) \
Chris@16 68 template< typename T > struct trait \
Chris@16 69 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 70 { \
Chris@16 71 public:\
Chris@16 72 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 73 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \
Chris@16 74 }; \
Chris@16 75 \
Chris@16 76 BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \
Chris@16 77 /**/
Chris@16 78
Chris@16 79
Chris@16 80 #define BOOST_TT_AUX_BOOL_TRAIT_DEF2(trait,T1,T2,C) \
Chris@16 81 template< typename T1, typename T2 > struct trait \
Chris@16 82 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 83 { \
Chris@16 84 public:\
Chris@16 85 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 86 BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \
Chris@16 87 }; \
Chris@16 88 \
Chris@16 89 BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \
Chris@16 90 /**/
Chris@16 91
Chris@16 92 #define BOOST_TT_AUX_BOOL_TRAIT_DEF3(trait,T1,T2,T3,C) \
Chris@16 93 template< typename T1, typename T2, typename T3 > struct trait \
Chris@16 94 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 95 { \
Chris@16 96 public:\
Chris@16 97 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 98 BOOST_MPL_AUX_LAMBDA_SUPPORT(3,trait,(T1,T2,T3)) \
Chris@16 99 }; \
Chris@16 100 \
Chris@16 101 BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(3,trait) \
Chris@16 102 /**/
Chris@16 103
Chris@16 104 #define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \
Chris@16 105 template<> struct trait< sp > \
Chris@16 106 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 107 { \
Chris@16 108 public:\
Chris@16 109 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 110 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \
Chris@16 111 }; \
Chris@16 112 /**/
Chris@16 113
Chris@16 114 #define BOOST_TT_AUX_BOOL_TRAIT_SPEC2(trait,sp1,sp2,C) \
Chris@16 115 template<> struct trait< sp1,sp2 > \
Chris@16 116 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 117 { \
Chris@16 118 public:\
Chris@16 119 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 120 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
Chris@16 121 }; \
Chris@16 122 /**/
Chris@16 123
Chris@16 124 #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \
Chris@16 125 template<> struct trait##_impl< sp > \
Chris@16 126 { \
Chris@16 127 public:\
Chris@16 128 BOOST_STATIC_CONSTANT(bool, value = (C)); \
Chris@16 129 }; \
Chris@16 130 /**/
Chris@16 131
Chris@16 132 #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \
Chris@16 133 template<> struct trait##_impl< sp1,sp2 > \
Chris@16 134 { \
Chris@16 135 public:\
Chris@16 136 BOOST_STATIC_CONSTANT(bool, value = (C)); \
Chris@16 137 }; \
Chris@16 138 /**/
Chris@16 139
Chris@16 140 #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_1(param,trait,sp,C) \
Chris@16 141 template< param > struct trait< sp > \
Chris@16 142 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 143 { \
Chris@16 144 public:\
Chris@16 145 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 146 }; \
Chris@16 147 /**/
Chris@16 148
Chris@16 149 #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,sp,C) \
Chris@16 150 template< param1, param2 > struct trait< sp > \
Chris@16 151 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 152 { \
Chris@16 153 public:\
Chris@16 154 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 155 }; \
Chris@16 156 /**/
Chris@16 157
Chris@16 158 #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
Chris@16 159 template< param > struct trait< sp1,sp2 > \
Chris@16 160 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 161 { \
Chris@16 162 public:\
Chris@16 163 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 164 BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \
Chris@16 165 }; \
Chris@16 166 /**/
Chris@16 167
Chris@16 168 #define BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_2(param1,param2,trait,sp1,sp2,C) \
Chris@16 169 template< param1, param2 > struct trait< sp1,sp2 > \
Chris@16 170 BOOST_TT_AUX_BOOL_C_BASE(C) \
Chris@16 171 { \
Chris@16 172 public:\
Chris@16 173 BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \
Chris@16 174 }; \
Chris@16 175 /**/
Chris@16 176
Chris@16 177 #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \
Chris@16 178 template< param > struct trait##_impl< sp1,sp2 > \
Chris@16 179 { \
Chris@16 180 public:\
Chris@16 181 BOOST_STATIC_CONSTANT(bool, value = (C)); \
Chris@16 182 }; \
Chris@16 183 /**/
Chris@16 184
Chris@16 185 #ifndef BOOST_NO_CV_SPECIALIZATIONS
Chris@16 186 # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
Chris@16 187 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
Chris@16 188 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const,value) \
Chris@16 189 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp volatile,value) \
Chris@16 190 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp const volatile,value) \
Chris@16 191 /**/
Chris@16 192 #else
Chris@16 193 # define BOOST_TT_AUX_BOOL_TRAIT_CV_SPEC1(trait,sp,value) \
Chris@16 194 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,value) \
Chris@16 195 /**/
Chris@16 196 #endif