|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-09-21 14:12:52
From: "Peter Dimov" <pdimov_at_[hidden]>
> From: "David Abrahams" <dave_at_[hidden]>
> > #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?
>
> Hmm. I _think_ that #2 doesn't require a deallocator to be instantiated,
I suppose that if the count has a virtual destructor it can take care of
deletion:
struct counted_base {
int use_count;
virtual ~shared_count() = 0;
};
template <class T>
struct counted_base_impl : counted_base {
~shared_count_impl() { delete p; }
T* p;
};
> although #5 does.
I don't see how this case differs from #2.
> > 1. Should we think about optimizing away storage for the deleter when
it's
> > known to be stateless?
>
> We might, although I'm not convinced that it's worth it.
If we started using pool allocation as an optimization it might be.
> > 2. Should we think about avoiding vtbl bloat a la boost::function?
>
> What does "vtbl bloat" mean?
See http://www.boost.org/libs/function/#design
-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