From patchwork Wed Jul 14 20:12:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3] update shared_ptr docs From: Jonathan Wakely X-Patchwork-Id: 58925 Message-Id: To: "libstdc++" , gcc-patches Date: Wed, 14 Jul 2010 21:12:08 +0100 This updates the shared_ptr notes in the manual to reflect the current state of the code * doc/xml/manual/shared_ptr.xml: Update. * doc/html/*: Regenerate. Index: doc/xml/manual/shared_ptr.xml =================================================================== --- doc/xml/manual/shared_ptr.xml (revision 162174) +++ doc/xml/manual/shared_ptr.xml (working copy) @@ -88,7 +88,7 @@ resource. _Sp_counted_base<Lp> -The base of the hierarchy is parameterized on the lock policy alone. +The base of the hierarchy is parameterized on the lock policy (see below.) _Sp_counted_base doesn't depend on the type of pointer being managed, it only maintains the reference counts and calls virtual functions when the counts drop to zero. The managed object is destroyed when the last @@ -162,16 +162,6 @@ that simplifies the implementation sligh Thread Safety -The interface of tr1::shared_ptr was extended for C++0x -with support for rvalue-references and the other features from -N2351. As with other libstdc++ headers shared by TR1 and C++0x, -boost_shared_ptr.h uses conditional compilation, based on the macros -_GLIBCXX_INCLUDE_AS_CXX0X and -_GLIBCXX_INCLUDE_AS_TR1, to enable and disable -features. - - - C++0x-only features are: rvalue-ref/move support, allocator support, aliasing constructor, make_shared & allocate_shared. Additionally, the constructors taking auto_ptr parameters are @@ -306,18 +296,26 @@ used when libstdc++ is built without
  • Dual C++0x and TR1 Implementation +The interface of tr1::shared_ptr was extended for C++0x +with support for rvalue-references and the other features from N2351. +The _Sp_counted_base base class is implemented in +tr1/boost_sp_shared_count.h and is common to the TR1 +and C++0x versions of shared_ptr. + + + The classes derived from _Sp_counted_base (see Class Hierarchy -below) and __shared_count are implemented separately for C++0x -and TR1, in bits/boost_sp_shared_count.h and -tr1/boost_sp_shared_count.h respectively. All other classes -including _Sp_counted_base are shared by both implementations. +above) and __shared_count are implemented separately for C++0x +and TR1, in bits/shared_ptr.h and +tr1/shared_ptr.h respectively. The TR1 implementation is considered relatively stable, so is unlikely to change unless bug fixes require it. If the code that is common to both C++0x and TR1 modes needs to diverge further then it might be necessary to -duplicate additional classes and only make changes to the C++0x versions. +duplicate _Sp_counted_base and only make changes to +the C++0x version. @@ -421,18 +419,18 @@ the following types, depending on how th Examples Examples of use can be found in the testsuite, under - testsuite/tr1/2_general_utilities/shared_ptr. + testsuite/tr1/2_general_utilities/shared_ptr, + testsuite/20_util/shared_ptr + and + testsuite/20_util/weak_ptr.
    Unresolved Issues - The resolution to C++ Standard Library issue 674, - "shared_ptr interface changes for consistency with N1856" will - need to be implemented after it is accepted into the working - paper. Issue 743 - might also require changes. + The shared_ptr atomic access + clause in the C++0x working draft is not implemented in GCC. @@ -476,11 +474,6 @@ the following types, depending on how th would alter the ABI. - - Exposing the alias constructor in TR1 mode could simplify the - *_pointer_cast functions. Constructor could be private in TR1 - mode, with the cast functions as friends. -