|
Boost : |
From: Caleb Epstein (caleb.epstein_at_[hidden])
Date: 2006-02-23 12:33:25
On 2/23/06, David Gruener <gruenedd_at_[hidden]> wrote:
>
> It seems that the polymorphic casts are deprecated without replacement
> with the new *_pointer_cast style. Why?
Are you asking why e.g:
boost::shared_ptr<Base> b (new Derived);
boost::shared_ptr<Derived> d = boost::dynamic_pointer_cast<Derived> (b);
is used instead of:
boost::shared_ptr<Derived> d = dynamic_cast<Derived*> (b.get());
?
I think the answer is that there would be no way for the reference count to
be shared between "b" and "d" without Base deriving from
boost::shared_from_this, so there would be no way to correctly determine
when to delete the pointee.
-- Caleb Epstein caleb dot epstein at gmail dot com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk