
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 09 April 2008 08:07 am, Daniel Frey wrote:
Before the change, I even wondered if the weak_ptr could be replaced by a detail::weak_count, which would reduce the overhead from two plain pointers to only one plain pointer, since shared_from_this always has *this.
But *this inside enable_shared_from_this<T> is not a T*, it is a enable_shared_from_this<T>*. To downcast it to a T* requires a dynamic_cast for the general case, which requires a vtable. Not that I consider a vtable to be significant overhead (I know, it's a horrifiying opinion for a C++ programmer but there it is). - -- Frank -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFH/P925vihyNWuA4URAgQHAKDGiQq+OzEyLcGyCNwUk39rM6hFKwCfXGAx bohqAEpSPt9NJKUPBSWWn6U= =j1Bh -----END PGP SIGNATURE-----