Is there a way to test std::is_base_of<A, B>
when A
is a template class?
template <typename X, typename Y> class A {};
template <typename X> class B : public A<X, char> {};
I want to statically test something like, std::is_base_of<A, B<int>>
meaning, B
is derived from any specialization of A
.
(To make it more general, let's say we don't know the way B
specializes A
, i.e. B<X> derives from A<X, char>)
One way to solve would be to derived A from a (non-template) class say C
, and then check std::is_base_of<C, B<int>>
. But is there another way to do this?