Lumiera
0.pre.03
»edit your freedom«
|
The purpose of these metaprogramming techniques is to write generic containers, handlers, iterators etc, which automatically adapt themselves to the abilities of their payload type. To give an example, we may investigate the argument type of a functor or lambda, and then compose it with a suitable adapter or converter to work with the given data.
However, when it comes to detecting the presence of a specific function, there are some complexities and variations to consider. Sometimes we only want to check for the presence of some function, while in other cases we also want to verify the exact signature of that function. Moreover, some of these detection techniques break down whenever there is overload ambiguity; thus we might need to resort to an alternative, not so strict test to get past such limitations.
Definition at line 99 of file duck-detector-extension-test.cpp.
Private Member Functions | |
void | detect_freeFunctionADL_ExtensionPoint () |
void | detect_memberFunctionVariations () |
META_DETECT_EXTENSION_POINT (funZ) | |
META_DETECT_EXTENSION_POINT (fun) | |
META_DETECT_FUNCTION (double, funny,(char, char, string)) | |
META_DETECT_FUNCTION (long long, fuzzy,(void)) | |
META_DETECT_FUNCTION_ARGLESS (funny) | |
META_DETECT_FUNCTION_ARGLESS (funky) | |
META_DETECT_FUNCTION_ARGLESS (fuzzy) | |
META_DETECT_FUNCTION_NAME (funny) | |
META_DETECT_FUNCTION_NAME (funky) | |
META_DETECT_FUNCTION_NAME (fuzzy) | |
META_DETECT_FUNCTION_NAME (fully) | |
META_DETECT_MEMBER (funny) | |
META_DETECT_MEMBER (funky) | |
META_DETECT_MEMBER (fuzzy) | |
META_DETECT_MEMBER (fully) | |
void | run (Arg) |
|
inlineprivate |
It is a common idiom in C++ to expose an extension point through a free function, which is expected to be picked up by ADL. To mention a prominent example, any type can offer the ability to be iterated by injecting free functions begin(TY)
and end(TY)
, to yield a STL compatible iterator.
Since such an extension point is used just by invoking the unqualified function with the target type, we can build a meta predicate based on the fact if such an function invocation expression can be formed for the type in question.
Definition at line 144 of file duck-detector-extension-test.cpp.
|
inlineprivate |
Definition at line 181 of file duck-detector-extension-test.cpp.