【发布时间】:2011-05-16 18:27:39
【问题描述】:
如何声明一个迭代器
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
【问题讨论】: