smart pointers + “this” considered harmful?

后端 未结 8 1990
情书的邮戳
情书的邮戳 2020-12-14 12:10

In a C++ project that uses smart pointers, such as boost::shared_ptr, what is a good design philosophy regarding use of \"this\"?<

8条回答
  •  一生所求
    2020-12-14 12:23

    One example of correct use is return *this; in functions like operator++() and operator<<().

提交回复
热议问题