File indexing completed on 2025-01-18 09:52:54
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_TTI_DETAIL_TEMPLATE_PARAMS_HPP)
0008 #define BOOST_TTI_DETAIL_TEMPLATE_PARAMS_HPP
0009
0010 #include <boost/config.hpp>
0011 #include <boost/mpl/bool.hpp>
0012 #include <boost/mpl/eval_if.hpp>
0013 #include <boost/mpl/has_xxx.hpp>
0014 #include <boost/preprocessor/arithmetic/add.hpp>
0015 #include <boost/preprocessor/arithmetic/sub.hpp>
0016 #include <boost/preprocessor/array/elem.hpp>
0017 #include <boost/preprocessor/cat.hpp>
0018 #include <boost/preprocessor/punctuation/comma_if.hpp>
0019 #include <boost/preprocessor/repetition/repeat.hpp>
0020 #include <boost/preprocessor/repetition/enum.hpp>
0021 #include <boost/preprocessor/array/enum.hpp>
0022 #include <boost/preprocessor/array/size.hpp>
0023 #include <boost/tti/detail/denclosing_type.hpp>
0024 #include <boost/tti/gen/namespace_gen.hpp>
0025
0026 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
0027
0028 #define BOOST_TTI_DETAIL_TEMPLATE_PARAMETERS(z,n,args) \
0029 BOOST_PP_ARRAY_ELEM(BOOST_PP_ADD(4,n),args) \
0030
0031
0032 #define BOOST_TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION(args,introspect_macro) \
0033 template \
0034 < \
0035 typename BOOST_TTI_DETAIL_TP_T, \
0036 typename BOOST_TTI_DETAIL_TP_FALLBACK_ \
0037 = boost::mpl::bool_< BOOST_PP_ARRAY_ELEM(3, args) > \
0038 > \
0039 struct BOOST_PP_ARRAY_ELEM(0, args) \
0040 { \
0041 private: \
0042 introspect_macro(args) \
0043 public: \
0044 static const bool value \
0045 = BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args)< BOOST_TTI_DETAIL_TP_T >::value; \
0046 typedef typename BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
0047 < \
0048 BOOST_TTI_DETAIL_TP_T \
0049 >::type type; \
0050 }; \
0051
0052
0053 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
0054
0055 #define BOOST_TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE(z,n,args) \
0056 template \
0057 < \
0058 template \
0059 < \
0060 BOOST_PP_ENUM_ ## z \
0061 ( \
0062 BOOST_PP_SUB \
0063 ( \
0064 BOOST_PP_ARRAY_SIZE(args), \
0065 4 \
0066 ), \
0067 BOOST_TTI_DETAIL_TEMPLATE_PARAMETERS, \
0068 args \
0069 ) \
0070 > \
0071 class BOOST_TTI_DETAIL_TM_V \
0072 > \
0073 struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME(args, n) \
0074 { \
0075 }; \
0076
0077
0078 #define BOOST_TTI_DETAIL_HAS_MEMBER_SUBSTITUTE(args) \
0079 BOOST_PP_REPEAT \
0080 ( \
0081 BOOST_PP_ARRAY_ELEM(2, args), \
0082 BOOST_TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE, \
0083 args \
0084 ) \
0085
0086
0087 #define BOOST_TTI_DETAIL_HAS_MEMBER_INTROSPECT(args) \
0088 template< typename U > \
0089 struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
0090 { \
0091 BOOST_TTI_DETAIL_HAS_MEMBER_SUBSTITUTE(args) \
0092 BOOST_MPL_HAS_MEMBER_REJECT(args, BOOST_PP_NIL) \
0093 BOOST_MPL_HAS_MEMBER_ACCEPT(args, BOOST_PP_NIL) \
0094 BOOST_STATIC_CONSTANT \
0095 ( \
0096 bool, value = BOOST_MPL_HAS_MEMBER_TEST(args) \
0097 ); \
0098 typedef boost::mpl::bool_< value > type; \
0099 }; \
0100
0101
0102 #define BOOST_TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE(args) \
0103 BOOST_TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION \
0104 ( \
0105 args, \
0106 BOOST_TTI_DETAIL_HAS_MEMBER_INTROSPECT \
0107 ) \
0108
0109
0110 #else
0111
0112 #define BOOST_TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE(z,n,args) \
0113 template \
0114 < \
0115 template \
0116 < \
0117 BOOST_PP_ENUM_ ## z \
0118 ( \
0119 BOOST_PP_SUB \
0120 ( \
0121 BOOST_PP_ARRAY_SIZE(args), \
0122 4 \
0123 ), \
0124 BOOST_TTI_DETAIL_TEMPLATE_PARAMETERS, \
0125 args \
0126 ) \
0127 > \
0128 class BOOST_TTI_DETAIL_TM_U \
0129 > \
0130 struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_NAME_WITH_TEMPLATE_SFINAE \
0131 ( \
0132 args, \
0133 n \
0134 ) \
0135 { \
0136 typedef \
0137 BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args) \
0138 type; \
0139 }; \
0140
0141
0142 #define BOOST_TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE(args) \
0143 typedef void \
0144 BOOST_MPL_HAS_MEMBER_INTROSPECTION_SUBSTITUTE_TAG_NAME(args); \
0145 BOOST_PP_REPEAT \
0146 ( \
0147 BOOST_PP_ARRAY_ELEM(2, args), \
0148 BOOST_TTI_DETAIL_HAS_MEMBER_MULTI_SUBSTITUTE_WITH_TEMPLATE_SFINAE, \
0149 args \
0150 ) \
0151
0152
0153 #define BOOST_TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE(args) \
0154 BOOST_MPL_HAS_MEMBER_REJECT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
0155 BOOST_MPL_HAS_MEMBER_ACCEPT_WITH_TEMPLATE_SFINAE(args,BOOST_PP_NIL) \
0156 template< typename BOOST_TTI_DETAIL_TP_U > \
0157 struct BOOST_MPL_HAS_MEMBER_INTROSPECTION_NAME(args) \
0158 : BOOST_MPL_HAS_MEMBER_INTROSPECTION_TEST_NAME(args)< BOOST_TTI_DETAIL_TP_U > { \
0159 }; \
0160
0161
0162 #define BOOST_TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE(args) \
0163 BOOST_TTI_DETAIL_HAS_MEMBER_SUBSTITUTE_WITH_TEMPLATE_SFINAE \
0164 ( \
0165 args \
0166 ) \
0167 BOOST_TTI_DETAIL_HAS_MEMBER_IMPLEMENTATION \
0168 ( \
0169 args, \
0170 BOOST_TTI_DETAIL_HAS_MEMBER_INTROSPECT_WITH_TEMPLATE_SFINAE \
0171 ) \
0172
0173
0174 #endif
0175
0176 #else
0177
0178 #define BOOST_TTI_DETAIL_SAME(trait,name) \
0179 BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF \
0180 ( \
0181 trait, \
0182 name, \
0183 false \
0184 ) \
0185
0186
0187 #define BOOST_TTI_DETAIL_TRAIT_CALL_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tp) \
0188 BOOST_TTI_DETAIL_SAME(trait,name) \
0189
0190
0191 #endif
0192
0193 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS_OP(trait,name,tpArray) \
0194 BOOST_TTI_DETAIL_TRAIT_CALL_HAS_TEMPLATE_CHECK_PARAMS(BOOST_PP_CAT(trait,_detail),name,tpArray) \
0195 template<class BOOST_TTI_DETAIL_TP_T> \
0196 struct BOOST_PP_CAT(trait,_detail_cp_op) : \
0197 BOOST_PP_CAT(trait,_detail)<BOOST_TTI_DETAIL_TP_T> \
0198 { \
0199 }; \
0200
0201
0202 #define BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpArray) \
0203 BOOST_TTI_DETAIL_TRAIT_HAS_TEMPLATE_CHECK_PARAMS_OP(trait,name,tpArray) \
0204 template<class BOOST_TTI_DETAIL_TP_T> \
0205 struct trait \
0206 { \
0207 typedef typename \
0208 boost::mpl::eval_if \
0209 < \
0210 BOOST_TTI_NAMESPACE::detail::enclosing_type<BOOST_TTI_DETAIL_TP_T>, \
0211 BOOST_PP_CAT(trait,_detail_cp_op)<BOOST_TTI_DETAIL_TP_T>, \
0212 boost::mpl::false_ \
0213 >::type type; \
0214 BOOST_STATIC_CONSTANT(bool,value=type::value); \
0215 }; \
0216
0217
0218 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
0219 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1400)
0220
0221 #define BOOST_TTI_DETAIL_TRAIT_CALL_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpArray) \
0222 BOOST_TTI_DETAIL_HAS_MEMBER_WITH_FUNCTION_SFINAE \
0223 ( \
0224 ( BOOST_PP_ADD(BOOST_PP_ARRAY_SIZE(tpArray),4), ( trait, name, 1, false, BOOST_PP_ARRAY_ENUM(tpArray) ) ) \
0225 ) \
0226
0227
0228 #else
0229
0230 #define BOOST_TTI_DETAIL_TRAIT_CALL_HAS_TEMPLATE_CHECK_PARAMS(trait,name,tpArray) \
0231 BOOST_TTI_DETAIL_HAS_MEMBER_WITH_TEMPLATE_SFINAE \
0232 ( \
0233 ( BOOST_PP_ADD(BOOST_PP_ARRAY_SIZE(tpArray),4), ( trait, name, 1, false, BOOST_PP_ARRAY_ENUM(tpArray) ) ) \
0234 ) \
0235
0236
0237 #endif
0238 #endif
0239
0240 #endif