I miss a custom destructor version of shared_from_this. The only one
function just accepts a pointer and construct a shared_ptr from it. Should
shared_from_this also match shared_ptr's constructor that takes a pointer
and it's destructor function object, or the lack of it is a design decision?

I need the following (something like it):

struct drawobj_deleter
{
    void operator()(const CDrawObj* pObj) const
    {
          DeleteDrawObj(pObj);
    }
};

main()
{
     shared_ptr<CDrawObj> pObj = shared_from_this(new CDrawObj,
drawobj_deleter());
}

I know I could use de constructor directly, but I prefer using
shared_from_this because this way it's more explicit that we're "crossing
the boundary" between raw pointer and smart_pointer.

rod.



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to