首页 > 代码库 > effective c++ 条款10 handle assignment to self operator =

effective c++ 条款10 handle assignment to self operator =

非强制性,但是个好习惯

当使用连锁赋值时很有用

x=y=z=10;

class Window{  public:    Window& operator=(int size)    {     ...     return *this;    }}

这个规则适用于 -,+, +=,-= etc