std::auto_ptr or boost::shared_ptr for pImpl idiom?

后端 未结 9 1391
醉梦人生
醉梦人生 2020-12-23 15:04

When using the pImpl idiom is it preferable to use a boost:shared_ptr instead of a std::auto_ptr? I\'m sure I once read that the boost version is

9条回答
  •  爱一瞬间的悲伤
    2020-12-23 15:45

    I have been really happy about impl_ptr by Vladimir Batov [modified]. It makes it really easy to create a pImpl without needing to make explicit copy-constructor and assignment operator.

    I have modified the original code, so it now resembles a shared_ptr, so it can be used in epilog code, and remains speedy.

提交回复
热议问题