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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…