Boost logo

Boost Users :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-02-06 16:39:08


On Tuesday 06 February 2007 16:10 pm, Frank Mori Hess wrote:
> On Tuesday 06 February 2007 15:43 pm, Timmo Stange wrote:
> > Frank Mori Hess wrote:
> > > I've made some minor changes to shared_ptr.hpp and
> > > enable_shared_from_this.hpp as a proof of concept (diffs against
> > > boost 1.32 attached). It appears to work beautifully. The "real
> > > thing" would also take steps to make sure the postconstructor only
> > > gets called once (maybe in a "postconstructible" class derived from
> > > enable_shared_from_this. And the virtual function that is called in
> > > enable_shared_from_this might want a less specific name than
> > > postconstruct.
> > >
> > > Peter, is there any chance a change like this could get put in
> > > shared_ptr?
> >
> > I don't think adding polymorphism to something as widely used as
> > enable_shared_from_this is an option.
>
> Maybe the equivalent can be done using only with templates without
> polymorphism, I'll see if I can make that work.

Okay, here's the partial-template-specialization proof of concept, where
polymorphism is confined to a specialization of enable_shared_from_this.

-- 
Frank







Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net