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

前端 未结 10 2351
再見小時候
再見小時候 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 06:05

    introducing boost::shared_ptr forces your client to use boost. to some people, this is a minor issue.

    it also forces your clients to use the same compiler as used by your lib, if your lib is distributed as compiled binary. or, if your library is distributed in source code, the clients have to stick to their own choice of compiler used to compile your lib. this isn't a minor issue to any project of considerable size.

提交回复
热议问题