On Thu, Apr 12, 2018 at 2:48 PM, David Demelier via Boost-users < boost-users@lists.boost.org> wrote:
Hello,
In my application I use std::shared_ptr in the public API for loading plugins. I wanted to use boost::dll to import dynamically plugins as well.
It looks like for some reasons that it still use boost::shared_ptr instead of std::shared_ptr even though C++11 is 7 years old.
I wanted to convert the boost shared_ptr to std with the following function:
std::shared_ptr<plugin> load(boost::shared_ptr<plugin> ptr) { return std::shared_ptr<plugin>(ptr.get(), [ptr] (auto) {}); }
Look at <
https://stackoverflow.com/questions/12314967/cohabitation-of-boostshared-ptr-and-stdshared-ptr>,
which does a ptr.reset() in the deleter. It also describes the caveats
with this hack.
--
Nevin ":-)" Liber