93 #ifndef LIB_META_DUCK_DETECTOR_H 94 #define LIB_META_DUCK_DETECTOR_H 111 #define META_DETECT_NESTED(_TYPE_) \ 112 template<typename TY> \ 113 class HasNested_##_TYPE_ \ 117 static Yes_t check(typename X::_TYPE_ *); \ 119 static No_t check(...); \ 122 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 134 #define META_DETECT_MEMBER(_NAME_) \ 135 template<typename TY> \ 136 class HasMember_##_NAME_ \ 138 template<typename X, \ 139 typename SEL = decltype(&X::_NAME_)> \ 144 static Yes_t check(Probe<X> * ); \ 146 static No_t check(...); \ 149 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 161 #define META_DETECT_FUNCTION(_RET_TYPE_,_FUN_NAME_,_ARGS_) \ 162 template<typename TY> \ 163 class HasFunSig_##_FUN_NAME_ \ 165 template<typename X, _RET_TYPE_ (X::*)_ARGS_> \ 170 static Yes_t check(Probe<X, &X::_FUN_NAME_> * ); \ 172 static No_t check(...); \ 175 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 186 #define META_DETECT_FUNCTION_NAME(_FUN_NAME_) \ 187 template<typename TY> \ 188 class HasFunName_##_FUN_NAME_ \ 190 template<typename SEL> \ 192 template<class C, typename RET, typename...ARGS> \ 193 struct Probe<RET (C::*) (ARGS...)> \ 195 using Match = void; \ 197 template<class C, typename RET, typename...ARGS> \ 198 struct Probe<RET (C::*) (ARGS...) const> \ 200 using Match = void; \ 204 static Yes_t check(typename Probe<decltype(&X::_FUN_NAME_)>::Match * ); \ 206 static No_t check(...); \ 209 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 219 #define META_DETECT_FUNCTION_ARGLESS(_FUN_) \ 220 template<typename TY> \ 221 class HasArglessFun_##_FUN_ \ 223 template<typename X, \ 224 typename SEL = decltype(std::declval<X>()._FUN_())>\ 229 static Yes_t check(Probe<X> * ); \ 231 static No_t check(...); \ 234 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 248 #define META_DETECT_EXTENSION_POINT(_FUN_) \ 249 template<typename TY> \ 250 class HasExtensionPoint_##_FUN_ \ 252 template<typename X, \ 253 typename SEL = decltype( _FUN_(std::declval<X>()))>\ 258 static Yes_t check(Probe<X> * ); \ 260 static No_t check(...); \ 263 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 269 #define META_DETECT_OPERATOR_DEREF() \ 270 template<typename TY> \ 271 class HasOperator_deref \ 273 template<typename X, int i = sizeof(&X::operator*)> \ 278 static Yes_t check(Probe<X> * ); \ 280 static No_t check(...); \ 283 static const bool value = (sizeof(Yes_t)==sizeof(check<TY>(0))); \ 296 #define META_DETECT_OPERATOR_INC() \ 297 template<typename TY> \ 298 class HasOperator_inc \ 300 template<typename X, X& (X::*)(void)> \ 303 template<typename X, int i = sizeof(&X::operator++)> \ 308 static Yes_t check1(Probe_1<X, &X::operator++> * ); \ 310 static No_t check1(...); \ 312 static Yes_t check2(Probe_2<X> * ); \ 314 static No_t check2(...); \ 317 static const bool value = (sizeof(Yes_t)==sizeof(check1<TY>(0)) \ 318 ||sizeof(Yes_t)==sizeof(check2<TY>(0))); \