Detecting Inheritance
template <typename T, typename U>
class Conversion
{
... as before ...
public:
enum { exists = sizeof(Test(MakeT())) == sizeof(Small) };
enum { exists2Way = exists && Conversion<U,T>::exists};
enum { sameType = false };
};
template <typename T>
class Conversion<T,T>
{
public:
enum { exists = 1, exists2Way = 1, sameType = 1
};
};
#define SUPERSUBCLASS(T,U) (Conversion<const U*, const T*>::exists && \
!Conversion<const T*, const void*>::sameType)