Boost logo

Boost Users :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2005-03-07 12:44:08


"steve ahlgren" <steveahlgren_at_[hidden]> wrote in message
news:cfa9c0b705030709187f711e93_at_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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net