
How about resources shared across multiple instances, where the shared resource is hold by a static to a weak_ptr and each instance participating to that resource holds it as a shared ptr, to guarantee that there is no lifetime prolongation (same as approach for std::cout and others). Assumption for above statement : Construction of the resource is quite expensive. Another limitation, is if you do not have the choice. Relying on other frameworks, passing around objects with embedded reference counts, to enable sharing across language barriers, such like done by XPCOM in Mozilla between JS and C++ via idl. From: David Abrahams <dave@boostpro.com> To: boost@lists.boost.org Date: 28.05.2010 16:11 Subject: Re: [boost] Review of a safer memory management approach for C++? Sent by: boost-bounces@lists.boost.org [Please don't top post. Try outlook-quotefix or oe-quotefix: http://home.in.tum.de/~jain/software/outlook-quotefix/, http://home.in.tum.de/~jain/software/oe-quotefix/ ] At Fri, 28 May 2010 15:32:22 +0200, Ingo Loehken wrote:
From: David Abrahams <dave@boostpro.com>
Furthermore, your logic seems flawed to me. By analogy:
There is no need for Intel processors (we can all use AMD). Therefore there is no use for an Intel processor?
No, thats a twisted interpretation. I'm just pointing out, there is a need for shared ownership.
I'm not sure I agree that there actually is a need. All the shared ownership scenarios I can think of can be translated into single-ownership-at-a-higher-level. That, however, is not always convenient. -- Dave Abrahams Meet me at BoostCon: http://www.boostcon.com BoostPro Computing http://www.boostpro.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost