I wonder, whether there is any elegant way (like this) for checking that template argument is derived from a given class? In general:
template<class A, class B>
class MyClass
{
// shold give the compilation error if B is not derived from A
// but should work if B inherits from A as private
}
the solution provided in another question works only when B inherits from A as public:
class B: public A
however, I would rather not have such constraint:
class A{};
class B : public A{};
class C : private A{};
class D;
MyClass<A,B> // works now
MyClass<A,C> // should be OK
MyClass<A,D> // only here I need a compile error
Thanks in advance!!!