<分区>
Possible Duplicate:
Where and why do I have to put “template” and “typename” on dependent names?
这是我的问题:
template<typename TypeName> class Bubu
{
...
vector<TypeName>::iterator Foo()
{
...
}
...
}
这给出:
错误 C2146:语法错误:缺少“;”在标识符“Foo”之前
如果我将类型名称更改为实际类型,如 int 或 SomeClass,它会起作用:
vector<int>::iterator Foo(){}
我想要的是这样的:
Bubu<SomeClassType> bubuInstance;
vector<SomeClassType>::iterator it = bubuInstance.Foo();
怎么了?我该如何解决?