|
Boost Users : |
Subject: Re: [Boost-users] How shared_from_this() work when it inheritedfrom more than one time
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2009-08-10 08:52:00
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 10 August 2009, Björn Karlsson wrote:
>
> 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());
The shared_*_cast names are deprecated according to shared_ptr.hpp. They are
spelled *_pointer_cast now.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqAF/EACgkQ5vihyNWuA4VqFgCeO+XJhSihS1m+vxsDY0niQeEW
8LsAniPa51EYxc+dcwiI0ZdNndHsi9Wn
=KWJb
-----END PGP SIGNATURE-----
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