|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-09-21 13:20:49
From: "Peter Dimov" <pdimov_at_[hidden]>
> From: "David Abrahams" <dave_at_[hidden]>
> >
> > Tell me. I'm trying to describe the evolution of shared_ptr now, and it
> > seems to me that the extra pointer supports:
> >
> > Derived->Base conversion when there's no virtual destructor
> >
> > What else?
>
#1 shared_ptr<Base> when there's no _accessible_ ~Base, to prevent
deletion;
#2 Template parameter being an incomplete type at destruction time;
#3 Using shared_ptr<void> to retain ownership but strip type information
(similar to void*);
#4 Encapsulating allocation details via custom deallocators;
#5 Passing shared_ptr's across EXE/DLL boundaries that use different heaps.
#2 and #4 both require the addition of the custom deallocator, right?
Most compilers will do #5 correctly if the destructor is virtual, right?
BTW, implementation notions:
1. Should we think about optimizing away storage for the deleter when it's
known to be stateless?
2. Should we think about avoiding vtbl bloat a la boost::function?
-Dave
-----------------------------------------------------------
David Abrahams * Boost Consulting
dave_at_[hidden] * 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