Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2002-01-21 09:43:53


Peter Dimov wrote:

> From: "Larry Evans" <jcampbell3_at_[hidden]>
> > Greg Colvin wrote:
> >
> > > From: "Larry Evans" <jcampbell3_at_[hidden]>
> > > > ... Could someone
> > > > describe a case where this is not so, i.e. the user does not know what
> > > > the most derived class is when creating a shared_ptr<T>?
> > >
> > > When using a factory function that returns only a pointer to base?
> > >
> >
> > If you mean using the shared_ptr(T*) CTOR, then this is similar
> > to Maeder's example and, as pointed out in
> > http://groups.yahoo.com/group/boost/message/23341
> > and the user is responsible for avoiding this.
>
> I suppose Greg meant
>
> shared_ptr<Base> createObject(std::string classId);
>
> or something similar.
>

Yes, I realized that too late.

Now, about counted_base. Since one of the purposes of counted_base is to
overcome the lack of virtual DTOR, could John Maddox's is_polymorphic<>
trait be used to provide a specialized version of counted_base_impl without the
extra D del pointer?


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