我有这样的代码:
template<typename T> class Foo
{
struct Some_struct
{
T object;
Some_struct* next;
};
public:
Some_struct* function(); //declaration of my function
};
template<typename T> Some_struct* Foo<T>::function() //this definition is wrong
{
//something inside
return pointer_to_Some_struct;
}
正确的定义应如何显示?
您忘记为返回类型添加适当的范围。
这样做:
template<typename T> typename Foo<T>::Some_struct* Foo<T>::function()
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句