Getting a boost::shared_ptr for this

前端 未结 6 2060
有刺的猬
有刺的猬 2020-12-02 07:11

I am making extensive use of boost:shared_ptr in my code. In fact, most of the objects that are allocated on the heap are held by a shared_ptr. Unf

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 07:48

    Are you really making more shared copies of pFoo inside bar? If you aren't doing anything crazy inside, just do this:

    
    void bar(Foo &foo)
    {
        // ...
    }
    

提交回复
热议问题