dch*_*tri 4 c++ templates interface
我不认为这在C++中是可能的,我有什么选择来模拟行为?
Naw*_*waz 11
使用std::is_base_of如:
std::is_base_of
template<typename T> class A { static_assert(std::is_base_of<IMyInterface, T>::value, "T must derive from IMyInterface"); };
您也可以在功能模板中使用相同的功能.
Syn*_*xis 6
std::is_base_of<YourInterface, YourParameter>如果结果是,您可以使用并发出错误false.记住这是C++ 11.
std::is_base_of<YourInterface, YourParameter>
false
归档时间:
13 年,2 月 前
查看次数:
693 次
最近记录: