Created
January 24, 2013 08:49
-
-
Save dirvine/4618839 to your computer and use it in GitHub Desktop.
Concept checker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sfinae test for has ThisFunc() method | |
template <typename T> | |
class has_this_func { | |
typedef char one[1]; | |
typedef char two[2]; | |
template <typename U> static one test(decltype(&U::ThisFunc()); // could also be *U::Routing() for pointer to ThisFunc | |
// the above gets masked out as sfinae will choose two | |
template <typename U) static two test(...); | |
public: | |
static bool const value = sizeof(test<T>(0)) == sizeof(one); | |
// use has_this_func<T>::value as the test | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment