Boost logo

Boost Users :

Subject: Re: [Boost-users] How shared_from_this() work when it inheritedfrommore than one time
From: Björn Karlsson (Bjorn.Karlsson_at_[hidden])
Date: 2009-08-10 07:00:47


Hello Igor,

> Why not:
> boost::static_pointer_cast<B>(shared_from_this());

Yes, inside B (as in the example), static_pointer_cast is the right choice. The same rules apply as for the corresponding C++ casts, so when downcasting, shared_pointer_cast should be used instead.

Cheers,
Bjorn Karlsson
www.skeletonsoftware.net


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