1
为了澄清,我引述詹姆斯McNellis答案the post "Template assignment operator overloading mystery":赋值操作符的模板类
的隐式声明的拷贝赋值运算符,其声明如下,仍然产生:
Wrapper& operator=(const Wrapper&);
现在我有一个类似的类,想知道这个运算符的定义需要什么样子。
这里的召回类:
template<typename T>
struct Wrapper;
- 现在是修正的比赛:
template<typename T>
Wrapper& Wrapper<T>::operator=(const Wrapper&)
或
Wrapper& Wrapper::operator=(const Wrapper&)
?
或者这是一样的吗?
+1:太好了!非常感谢你! – Atmocreations