What's your convention for typedef'ing shared_ptr?

后端 未结 16 1703
北恋
北恋 2020-12-13 00:10

I\'m flip-flopping between naming conventions for typedef\'ing the boost::shared_ptr template. For example:

typedef boost::shared_ptr FooPtr;
         


        
16条回答
  •  旧时难觅i
    2020-12-13 00:40

    I usually encapsulate the the typedef inside the class. The reason is that we have some memory sensitive code, and it makes it easy to switch between boost::shared_ptr and boost::intrusive_ptr Since intrusive_ptr is something that the class needs to support, it makes sense to me to have the knowledge of which shared pointer to use be wrapped up in the class.

提交回复
热议问题