Boost logo

Boost Users :

Subject: Re: [Boost-users] How to obtain shared_ptr<Derived> from shared_ptr<Base>?
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2009-04-15 11:26:30


On Wed, Apr 15, 2009 at 9:59 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> Dominique Devienne wrote:
>> So long story short, is there a clean way to obtain a
>> shared_ptr<VehiculeIdent> from a shared_ptr<Ident> which one "knows"
>> is a VehiculeIdent, to avoid my as_shared_ptr hack above?
>
> I think you want static_pointer_cast.
> http://www.boost.org/libs/smart_ptr/shared_ptr.htm#static_pointer_cast

Thank you both Nat and Steven. I was unaware that shared_ptr had
equivalents to the standard casts. Makes perfect sense now. Thanks
again, --DD


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