More specifically, let's say I have a class template with parameters A
and B
, and I would like to have a compiler error (when the template is being instantiated) if B is not derived from A.
template<class A, class B>
class Foo
{
// static_assert(B is derived from A)
};
See Question&Answers more detail:os