
Hello, It seems that the polymorphic casts are deprecated without replacement with the new *_pointer_cast style. Why? David.

David Gruener wrote:
Hello,
It seems that the polymorphic casts are deprecated without replacement with the new *_pointer_cast style. Why?
Because the new casts are in TR1 and the polymorphic casts aren't. So if you care about portability between boost::shared_ptr and std::tr1::shared_ptr, you should stick to the new casts only.

Quoting Peter Dimov <pdimov@mmltd.net>:
Because the new casts are in TR1 and the polymorphic casts aren't. So if you care about portability between boost::shared_ptr and std::tr1::shared_ptr, you should stick to the new casts only.
Well, i don't care. For a std::tr1::shared_ptr there is no poly cast and thats ok. But there should be one for a boost::shared_ptr, because boost offers poly casts and they own so much. :] Thus, my question is why the ptr poly casts are not/no longer documented (i.e. not part of the public interface). David. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.

On 2/23/06, David Gruener <gruenedd@idmt.fraunhofer.de> 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
participants (4)
-
Caleb Epstein
-
David Gruener
-
gruenedd@idmt.fraunhofer.de
-
Peter Dimov