limit template type to only derive from certain base class.

// static_assert(std::is_base_of<Port, T>::value,
// "T must derive from Port");

原文地址:https://www.cnblogs.com/yangzhang/p/14398475.html