Boost logo

Boost :

From: Daniel Frey (d.frey_at_[hidden])
Date: 2008-04-10 19:13:40


On Thu, 2008-04-10 at 10:59 -0400, Frank Mori Hess wrote:
> On Thursday 10 April 2008 09:57 am, Daniel Frey wrote:
> > On Thu, 2008-04-10 at 09:27 -0400, Frank Mori Hess wrote:
> > > Also, on further thought, I don't think enable_shared_from_this_base
> > > needs to be a template class at all.
> >
> > If you have an easier implementation without further overhead, I'd be
> > happy to see it.
>
> This patch against trunk illustrates what I have in mind: shared_ptr_observer
> doesn't need to be a template class. I derived enable_shared_from_this from
> shared_ptr_observer so I could verify it still passes all the smart_ptr
> tests.

I like that you call _internal_accept_owner on T* directly, still I
think that I template class for tagging has some advantages. See the
attached code I played with. In it, A has the role of the tag class. As
the code shows, it is possible to have multiple classes like these, you
just need some manual forwarding in the more complicated cases.

Regards, Daniel




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