"multiple template parameter lists are not allowed" ?
"multiple template parameter lists are not allowed"?
我正在编写一个简单的类来管理一些代码弯路。
类:
class CDetourManager {
public:
CDetourManager() {}
~CDetourManager() {}
template<convention_type tp, typename retn, typename ...args>
VOID AddDetour( Detour<tp, retn, args...>* d ) {
m_Detours.push_back( d );
}
private:
template<convention_type tp, typename retn, typename ...args>
std::vector<Detour<tp, retn, args...>* > m_Detours;
};
但是我得到一个错误:Error 1 error C3857: 'CDetourManager::m_Detours': multiple template parameter lists are not
允许
有谁知道我能做些什么来摆脱这个错误吗?这是我第一次使用模板,所以我有点迷路了:(
您似乎想要存储指向Detour
s的指针的vector
。由于Detour
的每个专门化都有不同(且不相关)的类型,因此不可能直接这样做。但是,如果您使Detour
模板继承了某些IDetour
接口,该接口提供了在Detour
上操作所需的函数,那么您可以将AddDetour
编写为:
void AddDetour(IDetour *d) {
m_Detours.push_back(d);
}
and m_Detours
as:
std::vector<IDetour *> m_Detours;
相关文章:
- reference_wrapper导致"incomplete type is not allowed"
- 结构中的错误"Incomplete type is not allowed"
- 函数模板(它是类模板的成员)的显式专用化会产生"partial specialization is not allowed"错误,为什么?
- C++ - "Incomplete type not allowed"错误是什么意思,我该如何修复它?
- 在 iOS 上使用 Aruco 构建 OpenCV 时"Functional-style cast from id to double is not allowed"
- 浮子阵列抛出"incomplete type is not allowed"
- 类 C++ 错误:"Virtual is not allowed"
- 访问类引用信息的 C++ "Incomplete type not allowed"错误(具有前向声明的循环依赖项)
- 在编辑器中"Error: type name is not allowed"消息,但不在编译期间
- C++命令行"Operation not allowed in WOW64"
- 为什么海湾合作委员会说"a function-definition is not allowed here before '{' token"?
- 提升时出错"member function redeclaration not allowed":线程
- 为什么我使用这些意大利面模板会"error: type name is not allowed"?
- 错误:移植项目时"incomplete type is not allowed"
- C++结构"Incomplete type is not allowed"
- 在VS2013中使用NVCC编译时出现"modifier is not allowed on a destructor"错误
- 需要帮助: "IntelliSense: data member initializer is not allowed"
- " a namespace name is not allowed" javacpp 中的错误
- "multiple template parameter lists are not allowed" ?
- "Incomplete Type Is Not Allowed"错误