Boost logo

Boost :

From: David Bradley (dbradley_at_[hidden])
Date: 2003-02-05 21:18:42


Dave Abrahams wrote:

>Actually, shared_ptr magically deals with this problem by instantiating the
>deleter at the point where it takes ownership of its resource. As long as
>that's on the same side of the DLL boundary where the resource was
>allocated, you're golden.
>
>
>
That's something I missed in skimming the implementation, it looked as
though it was done in the header file. I guess I still find myself on
the side of seeing the benefits of policy based implementation, and
finding it hard to see the how it makes things more complex, other than
for people trying to create new smart pointers implementations, which I
would argue is difficult in itself and prone to more error than creating
the necessary traits class for a policy based system.

While working on Mozilla one of the cons against using Boost's shared
pointer was that it incurred additional storage for the counter, and the
engineers working on Mozilla wanted an intrusive implementation where
the counter was stored with the object. It looks like the current
implementation there is no way other than to create yet another smart
pointer class to do this. Had Boost gone the policy based route, Mozilla
would have been able to use such a smart pointer, as it is, Mozilla is
reinventing the wheel instead of using Boost.

David Bradley


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk