#include #include #include #include #include #include #include #include #include using namespace std; template struct IntType { enum { value = x }; }; template class TypeTrait { template struct Type { enum { isPointer = false }; enum { isConst = false }; using Plain = U; }; template struct Type { enum { isPointer = false }; enum { isConst = true }; using Plain = U; }; using small = char; struct Big {char big[2];}; template static small fun(...); template static Big fun(void (T2::*)()); // template // static IntType fun(...); // // template // static IntType fun(void (T2::*)()); public: enum { isConst = Type::isConst }; enum { isClass = sizeof(fun(0)) == sizeof(Big) }; // enum { isClass = fun(0)::value; }; int main() { string s; cout << TypeTrait::isClass << '\n'; cout << TypeTrait::isClass << '\n'; }