102 #ifndef LIB_META_DUCK_DETECTOR_H 103 #define LIB_META_DUCK_DETECTOR_H 120 #define META_DETECT_NESTED(_TYPE_) \ 121 template<typename TY> \ 122 class HasNested_##_TYPE_ \ 126 static Yes_t check(typename X::_TYPE_ *); \ 128 static No_t check(...); \ 131 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 143 #define META_DETECT_MEMBER(_NAME_) \ 144 template<typename TY> \ 145 class HasMember_##_NAME_ \ 147 template<typename X, \ 148 typename SEL = decltype(&X::_NAME_)> \ 153 static Yes_t check(Probe<X> * ); \ 155 static No_t check(...); \ 158 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 170 #define META_DETECT_FUNCTION(_RET_TYPE_,_FUN_NAME_,_ARGS_) \ 171 template<typename TY> \ 172 class HasFunSig_##_FUN_NAME_ \ 174 template<typename X, _RET_TYPE_ (X::*)_ARGS_> \ 179 static Yes_t check(Probe<X, &X::_FUN_NAME_> * ); \ 181 static No_t check(...); \ 184 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 195 #define META_DETECT_FUNCTION_NAME(_FUN_NAME_) \ 196 template<typename TY> \ 197 class HasFunName_##_FUN_NAME_ \ 199 template<typename SEL> \ 201 template<class C, typename RET, typename...ARGS> \ 202 struct Probe<RET (C::*) (ARGS...)> \ 204 using Match = void; \ 206 template<class C, typename RET, typename...ARGS> \ 207 struct Probe<RET (C::*) (ARGS...) const> \ 209 using Match = void; \ 213 static Yes_t check(typename Probe<decltype(&X::_FUN_NAME_)>::Match * ); \ 215 static No_t check(...); \ 218 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 228 #define META_DETECT_FUNCTION_ARGLESS(_FUN_) \ 229 template<typename TY> \ 230 class HasArglessFun_##_FUN_ \ 232 template<typename X, \ 233 typename SEL = decltype(std::declval<X>()._FUN_())>\ 238 static Yes_t check(Probe<X> * ); \ 240 static No_t check(...); \ 243 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 257 #define META_DETECT_EXTENSION_POINT(_FUN_) \ 258 template<typename TY> \ 259 class HasExtensionPoint_##_FUN_ \ 261 template<typename X, \ 262 typename SEL = decltype( _FUN_(std::declval<X>()))>\ 267 static Yes_t check(Probe<X> * ); \ 269 static No_t check(...); \ 272 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 278 #define META_DETECT_OPERATOR_DEREF() \ 279 template<typename TY> \ 280 class HasOperator_deref \ 282 template<typename X, int i = sizeof(&X::operator*)> \ 287 static Yes_t check(Probe<X> * ); \ 289 static No_t check(...); \ 292 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 305 #define META_DETECT_OPERATOR_INC() \ 306 template<typename TY> \ 307 class HasOperator_inc \ 309 template<typename X, X& (X::*)(void)> \ 312 template<typename X, int i = sizeof(&X::operator++)> \ 317 static Yes_t check1(Probe_1<X, &X::operator++> * ); \ 319 static No_t check1(...); \ 321 static Yes_t check2(Probe_2<X> * ); \ 323 static No_t check2(...); \ 326 static const bool value = (sizeof(Yes_t)==sizeof(check1<TY>(0)) \ 327 ||sizeof(Yes_t)==sizeof(check2<TY>(0))); \