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
It's pretty cool but it doesn't actually work, because user-defined conversion is preferred to ellipsis match, and const reference can bind the temporary result of a user-defined conversion. So char*p; is_related
would return true
(tested in VS2010).
If you want to truly test for an inheritance relationship, a similar approach can be taken but using pointers instead of references.