Using boost::shared_ptr in a library's public interface

前端 未结 10 2404
再見小時候
再見小時候 2021-02-14 05:31

We have a C++ library that we provide to several different clients. Recently we made the switch from using raw pointers in the public interface to using boost::sharedptr instead

10条回答
  •  旧时难觅i
    2021-02-14 05:51

    Use auto_ptr or stick to a C interface. Forcing C++ libs into your interface is always ugly, kills any chance of being cross platform, and causes a maintenance nightmare for customers with different "downstream" configurations.

    As soon as C++0x is mainstream enough for your clients, switch to std::shared_ptr.

提交回复
热议问题