问题描述
class base
{
public:
base(const base&) = delete;
base()
{
cout << "construct" << endl;
}
~base()
{
cout << "destruct" << endl;
}
int a;
int b;
/* The difference explanation I desired is here */
void operator=(base&& other)
// base& operator=(base&& other) // this needs to collaborate with "return *this"
{
this->a = other.a;
this->b = other.b;
// return *this;
}
/* Not here */
base& operator=(base& other) = delete;
};
operator=(T&&)
的两个版本有什么区别?他们似乎都对我有用。但是,作为类成员函数,网站推荐base& operator=(T&&)
版本。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)