Not quite the answer to this question, but a different approach to your problem. It’s easier for me to run SFINAE tests by specialization, and not by the functions defined in this template:
template<typename T> struct tovoid { typedef void type; };
Using this to pass a type that might be invalid:
template<typename T, typename U = void>
struct is_class {
static bool const value = false;
};
template<typename T>
struct is_class<T, typename tovoid<int T::*>::type> {
static bool const value = true;
};
Thus, it is much shorter and noise with sizeofand everything is not done.
source
share