What are potential dangers when using boost::shared_ptr?

后端 未结 13 873
猫巷女王i
猫巷女王i 2020-12-02 07:42

What are some ways you can shoot yourself in the foot when using boost::shared_ptr? In other words, what pitfalls do I have to avoid when I use boost::shared_ptr?

13条回答
  •  旧巷少年郎
    2020-12-02 08:20

    Giving out a shared_ptr< T > to this inside a class definition is also dangerous. Use enabled_shared_from_this instead.

    See the following post here

提交回复
热议问题