
Hello : Is there safe/easy way to downcast shared pointers? ie boost::shared_ptr< Derived_Type > dPtr = [appropriate_method_here] ( base_ptr ); Thanks in advance; Steve a.

steve ahlgren wrote:
Hello :
Is there safe/easy way to downcast shared pointers?
ie boost::shared_ptr< Derived_Type > dPtr = [appropriate_method_here] ( base_ptr );
Look at the *_pointer_cast functions... http://www.boost.org/libs/smart_ptr/shared_ptr.htm#functions shared_ptr -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq

"steve ahlgren" <steveahlgren@gmail.com> wrote in message news:cfa9c0b705030709187f711e93@mail.gmail.com...
Hello :
Is there safe/easy way to downcast shared pointers?
ie boost::shared_ptr< Derived_Type > dPtr = [appropriate_method_here] ( base_ptr );
Thanks in advance; Steve a.
You could downcast reference instead of shared_ptr. Derived_Type& derived_ref = polymorphic_downcast<Derived_Type&>( *base_ptr ); I am not sure it what you want though. Gennadiy
participants (3)
-
Gennadiy Rozental
-
Rene Rivera
-
steve ahlgren