C ++,迭代器为std :: map
|
如何声明一个迭代器
std::map <T, Point <T> *> ,
哪里:
template <typename T>
struct TList
{
typedef std::vector < std::map <T, Point <T> *> > Type;
};
在下面的代码中
int main ()
{
....
std::map <T, Point <T> *> ::iterator i_map; //Error
...
}
g ++显示此错误:
error: dependent-name ` std::map<T,Point<T>*,std::less<_Key>,std::allocator<std::pair<const T, Point<T>*> > >::iterator\' is parsed as a non-type, but instantiation yields a type
note: say `typename std::map<T,Point<T>*,std::less<_Key>,std::allocator<std::pair<const T, Point<T>*> > >::iterator\' if a type is meant
没有找到相关结果
已邀请:
4 个回复
殿虫
作为:
由于
是从属名称(因为它取决于地图的类型参数argument7ѭ),因此此处需要
。 阅读此常见问题以获取详细说明: 为什么必须在何处以及为什么要放置“模板”和“类型名”关键字?
缕嚏冻
蜗仓馈
呢?
捕暑句簿姓
\”放在错误行:
之前。 例: