
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, May 02, 2011, Peter Dimov wrote:
// thread B // p2 goes out of scope: undefined, the destructor is considered a
"write access"
This example just says that you can't make a copy of a destroyed shared_ptr, or one that is in the process of being destroyed. In principle, it has nothing to do with reference counts. Doing something with a destroyed object of any type is undefined behavior in C++.
It looks like the example isn't quite right though, as p2 was declared in thread A so it can't go out of scope in thread B. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk2+qzEACgkQ5vihyNWuA4WHUgCePic0zbvdEHuv97Y7nnFOF6LP sncAnArkgbD3wXZjRlmxGFY7X+KrIix7 =VN8Y -----END PGP SIGNATURE-----