Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-09-21 14:55:46


From: "David Abrahams" <dave_at_[hidden]>
> > 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.

Trying to imagine how things work in an ODR-less world always causes my head
to hurt. I think that you are right and the above will work.

> > > 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.

Pool allocation is another optimization that I'm not fond of. :-)

> > > 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

I think I understand. This is another optimization that would complicate the
implementation.


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