I got a library that internally uses Boost\'s version of shared_ptr
and exposes only those. For my application, I\'d like to use std::shared_ptr
wh
You can carry the boost::shared_ptr "inside" the std::shared_ptr by using the destructor to carry the reference around:
template
void do_release(typename boost::shared_ptr const&, T*)
{
}
template
typename std::shared_ptr to_std(typename boost::shared_ptr const& p)
{
return
std::shared_ptr(
p.get(),
boost::bind(&do_release, p, _1));
}
The only real reason to do this is if you have a bunch of code that expects std::shared_ptr
.