Subject: [Boost-bugs] [Boost C++ Libraries] #2911: shared_from_this free function
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-04-03 21:27:21
#2911: shared_from_this free function
------------------------------+---------------------------------------------
Reporter: fhess | Owner: pdimov
Type: Feature Requests | Status: new
Milestone: Boost 1.39.0 | Component: smart_ptr
Version: Boost 1.38.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
Attached is an implementation of a free shared_from_this function, plus a
non-template enable_shared_from_this_base class which can only be used
with the free shared_from_this function. The free function will also work
with the usual enable_shared_from_this template. It is implemented on top
of the existing enable_shared_from_this class, and so requires no
modification of the existing smart_ptr code.
This scheme has the advantage of simplicity, since the "curiously
recurring template pattern" is not needed. It also "just works" if you
have a class hierarchy that looks like "X is derived from Y is derived
from enable_shared_from_this_base" and want to use shared_from_this with
both X and Y.
I've only tried it with gcc 4.3.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2911> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC