1. How (or rather Why) does is_class works.
There are two key concepts: 1) A class type is the only kind of type that can have a member function. 2) When the compiler performs template argument substition to a function signature, if the signature is an invalid type then the signature is ignored without a compiler error (sometimes called Substitution Failure Is Not An Error or SFINAE). So given the overloads: template <class T> void f(int (T::*)(int)); / #1 template <class T> void f(...); // #2 The expression: f<T>(0); Will call #1 if T is a class type, or #2 otherwise.
2. Same for is_enum
An enum type is the only type that has a built-in implicit conversion to int, but is not itself an integer type. Combine that with the fact that only one user-defined conversion may be performed per conversion sequence, and you have the implementation. John.