Boost logo

Boost Users :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-02-07 13:18:28


On Tuesday 06 February 2007 21:57 pm, Frank Mori Hess wrote:
> Now I realize I don't need any changes to shared_ptr at all, I can do it
> all in a wrapper function inserted between the raw pointer and
> shared_ptr. I can't think of a name, so call it ptr_wrapper():
>
> shared_ptr<MyClass>(signalslib::ptr_wrapper(new MyClass));
>
> ptr_wrapper would call postconstruct() if its input pointer is derived
> from postconstructible, and return a shared_ptr. The deleter for the
> returned shared pointer would be (by default) customized to call the
> predestructor if the input pointer is derived from predestructible. A
> custom deleter could be accepted as a second argument to ptr_wrapper.

If anyone is interested, I've put an implementation of this idea into the
boost-sandbox cvs, in the files postconstructible.hpp,
predestructible.hpp, and deconstruct_ptr.hpp. I called the wrapper
function deconstruct_ptr().

-- 
Frank



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net