可能重复:
Where and why do I have to put the “template” and “typename” keywords?如何为泛型类型的向量声明一个迭代器?
我声明为是一个通用类型的矢量的迭代器的问题。 代码如下:
template <class T> void print(const vector<T>& V)
{
vector<T>::const_iterator i;
}
下面返回预期的误差;于我之前'。 如果我特别说明,将不会有错误vector<int>::const_iterator i;
有没有办法解决这个问题?
'类型名称矢量 ::为const_iterator我;' –
hmjd