条款 10:令 operator= 返回一个 reference to *this

    Have assignment operators return a reference to *this.

    为了下列实现“连锁赋值”,需要令赋值操作符返回一个操作符左侧实参的引用

    1. a = b = c = 15;
    1. Widget& operator=(const Widget& ths)
    2. {
    3. ...
    4. return *this;
    5. }
    6. Widget& operator=(int rhs)
    7. {
    8. ...
    9. return *this;
    10. }

    这并非强制性,但所有内置类型和标准程序库提供的类型如:string、vector、complex、shared_ptr 都遵守。