muk*_*kul 2 c++ templates stl compiler-errors map
以下代码表示错误:expected';' 在'forwit'错误之前:预期';' 在'revit'之前
template<class T>
class mapping {
public:
map<T,int> forw;
map<int,T> rev;
int curr;
//typeof(forw)::iterator temp;
map<T,int>::iterator forwit;
map<int,T>::iterator revit;
};
// }; // JVC: This was present, but unmatched.
Run Code Online (Sandbox Code Playgroud)
我完全不知道问题是什么?请帮忙.
提前致谢
为了帮助编译器理解您正在讨论模板化上下文中的类型,您必须帮助它编写typename
.
在你的情况下
typename map<T,int>::iterator forwit;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2405 次 |
最近记录: |