Boost logo

Boost Users :

Subject: Re: [Boost-users] How shared_from_this() work when it inheritedfrom more than one time
From: Igor R (boost.lists_at_[hidden])
Date: 2009-08-10 04:05:46


> Don't let B inherit from enable_shared_from_this. You've already done that in A. So your question then becomes "how do I retrieve a shared_ptr<B> from this?". Here's how:
>
>  boost::shared_dynamic_cast<B, A>(shared_from_this());

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


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