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)
};
This has been asked so very many times before, but it’s so simple I’ll post the solution again: