|
Boost : |
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-04-11 14:02:02
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday 11 April 2008 12:11 pm, Peter Dimov wrote:
> I'm still not 100% convinced that we need this functionality in shared_ptr.
> But if we do, it seems that the proper way to add it is to make shared_ptr
> issue an unqualified call to
>
> sp_accept_owner( this, p );
It does provide an alternative to making shared_from_this() callable in
constructors. As long as sp_accept_owner() is always run after
enable_shared_from_this is set up (and there is no reason it can't be since
shared_ptr is fully aware of enable_shared_from_this) then it is usable as a
post constructor where shared_from_this can be used safely. Actually, you
don't even need enable_shared_from_this if don't need to use
shared_from_this() outside the postconstructor, since you are passed in the
owning shared_ptr.
- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFH/6eb5vihyNWuA4URAm1sAKC1tyt47Sht/EUzduL1E8x4HUGMBgCdFXFE
zuOYVtIF4UpU9sskqZYp13Q=
=OlLr
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk