|
Boost : |
From: Dave Abrahams (dave_at_[hidden])
Date: 2003-02-05 19:47:35
On Wednesday, February 05, 2003 6:37 PM [GMT+1=CET],
David Bradley <dbradley_at_[hidden]> wrote:
> From what I can
> tell, since smart_ptr has no traits, there's no way for library
^^^^^^^^^
You must mean shared_ptr
> implementors to deal with this scenario, other than to abandon smart
> pointers and use raw pointers across library bounders, or use a policy
> based system that would allow them more control.
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.
It's capabilities like this, all packaged behind the interface of a single
static type, which make the design of boost::shared_ptr so powerful.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk