A coworker recently showed me some code that he found online. It appears to allow compile time determination of whether a type has an \"is a\" relationship with another type. I
The original code will construct an object of Derived, it may brings unexpected result. Below work may be an alternative choice:
template inline bool isDerived(const CheckT &t){ char test(const BaseT *t); char (&test(...))[2]; return (sizeof(test(&t)) == sizeof(char) ); }