Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-18 15:36:10


From: "Thomas Maeder" <maeder_at_[hidden]>
> Am 2002.01.18 20:41 schrieb(en) Peter Dimov:
> > Possible, but inconvenient. There is no good reason to introduce
> > undefined
> > behavior here. Consider:
> >
> > shared_ptr<Derived> d(new Derived);
> > shared_ptr<Base> b(d);
> > b.reset();
> > d.reset();
> >
> > The second line is the same but it now works (with the current
> > implementation.)
>
> Is there a realistic use case where the second line is needed / useful
> in a class hierarchy without a virtual base class destructor?

Good question.

Is there a realistic use case where the Derived* -> Base* implicit
conversion is useful when Base is not polymorphic? ;-)

Of course the current shared_ptr<> doesn't support static_cast or Base==void
but let's pretend that we are discussing a version that does (you know where
to find it.)

--
Peter Dimov
Multi Media Ltd.

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