草庐IT

CallTsBaseClassFunction

全部标签

c++ - 如何强制模板 <class> 从 BaseClassA 派生?

是否有可能强制模板来自某个基类,以便我可以调用基类函数?templatevoidSomeManager::Add(T){T->CallTsBaseClassFunction();//...dootherstuff} 最佳答案 当然,您可以将类型特征与SFINAE结合起来:#includetemplatetypenamestd::enable_if::value,void>::typeSomeManager::Add(T){T->CallTsBaseClassFunction();//...dootherstuff}虽然我并没有真正看

c++ - 如何强制模板 <class> 从 BaseClassA 派生?

是否有可能强制模板来自某个基类,以便我可以调用基类函数?templatevoidSomeManager::Add(T){T->CallTsBaseClassFunction();//...dootherstuff} 最佳答案 当然,您可以将类型特征与SFINAE结合起来:#includetemplatetypenamestd::enable_if::value,void>::typeSomeManager::Add(T){T->CallTsBaseClassFunction();//...dootherstuff}虽然我并没有真正看