From 4f964ce6ada8f1585828f1320511acc9892b94fa Mon Sep 17 00:00:00 2001
From: Beman Dawes
Q. Why doesn't shared_ptr provide a release() function?
+A. shared_ptr cannot give away ownership unless it's unique()
+because the other copy will still destroy the object.
Consider:
+++shared_ptr<int> a(new int); +shared_ptr<int> b(a); // a.use_count() == b.use_count() == 2 + +int * p = a.release(); + +// Who owns p now? b will still call delete on it in its destructor.+
[Provided by Peter Dimov]
Q. Why doesn't shared_ptr provide (your pet feature here)?
A. Because (your pet feature here) would mandate a reference counted (or a link-list, or ...) implementation. This is not the intent.
-[Provided by Peter Dimov]
+[Provided by Peter Dimov]
Revised 11 January, 2002