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

前端 未结 10 2345
再見小時候
再見小時候 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条回答
  •  伪装坚强ぢ
    2021-02-14 05:56

    One possible solution is to ship boost::shared_ptr with your project. As it all consists of headers, this would free your clients from having to install the boost libraries manually. You can use bcp to get all files needed by a particular boost library, including the libraries itself. I did that when i worked for a company back then and needed boost::shared_ptr and it actually worked greatly.

提交回复
热议问题