From: "Hickman, Greg" <[EMAIL PROTECTED]> > I notice that a shared_ptr can be constructed directly from an > intrusive_ptr, ...
This is no longer the case with the current version. The implicit conversion has been removed. > ... but a weak_ptr cannot. Is there some reason why we wouldn't > want to add the appropriate constructor to weak_ptr? weak_ptr doesn't play well with intrusive counted objects. It is supposed to keep the count alive, but not affect the object's lifetime. When the count is embedded within the object, weak_ptr keeps the whole object alive. This is confusing. The currently blessed way to get a shared_ptr from an intrusive_ptr is to use a custom deleter: template<class T> struct intrusive_deleter { void operator()(T * p) { if(p) intrusive_ptr_release(p); } }; shared_ptr<X> make_shared_from_intrusive(X * p) { if(p) intrusive_ptr_add_ref(p); shared_ptr<X> px(p, intrusive_deleter<X>()); return px; } _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost