摘要: [toc] * 成员函数里用shared_ptr包装this指针,当shared_ptr析构了,就会调用this对象的析构函数,是非常可怕的事情。 ``` class A { void eat() { std::shared_ptr p(this); ptr->status = "吃了"; } } 阅读全文
posted @ 2023-07-17 12:39 马角的逆袭 阅读(82) 评论(0) 推荐(0) 编辑