]> gcc.gnu.org Git - gcc.git/commitdiff
user.cfg.in: Adjust includes.
authorBenjamin Kosnik <bkoz@redhat.com>
Fri, 6 Nov 2009 22:15:17 +0000 (22:15 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Fri, 6 Nov 2009 22:15:17 +0000 (22:15 +0000)
2009-11-06  Benjamin Kosnik  <bkoz@redhat.com>

* doc/doxygen/user.cfg.in: Adjust includes.

* doc/doxygen/doxygroups.cc: Move group markup.
* include/tr1_impl/regex: Change " to '. Add group markup.
* include/std/utility: Same.
* include/std/type_traits: Same.
* include/std/streambuf: Same.
* include/std/iosfwd: Same.
* include/std/limits: Same.
* include/std/sstream: Same.
* include/profile/impl/profiler_state.h: Same.
* include/profile/impl/profiler_hashtable_size.h: Same.
* include/bits/stl_algobase.h: Same.
* include/bits/stl_iterator_base_types.h: Same.
* include/bits/stream_iterator.h: Same.
* include/bits/stl_iterator.h: Same.
* include/bits/stl_tempbuf.h: Same.
* include/bits/streambuf_iterator.h: Same.
* libsupc++/exception: Same.
* libsupc++/cxxabi.h: Same.
* include/tr1_impl/type_traits: Same.

* include/parallel/multiway_merge.h: Change @__c to @c, @__f to @f.
* include/parallel/list_partition.h: Same.
* include/parallel/for_each.h: Same.
* include/parallel/workstealing.h: Same.
* include/parallel/base.h: Same.
* include/parallel/equally_split.h: Same.
* include/parallel/random_shuffle.h: Same.
* include/parallel/balanced_quicksort.h: Same.
* include/parallel/merge.h: Same.
* include/parallel/multiway_mergesort.h: Same.
* include/parallel/compatibility.h: Same.
* include/parallel/queue.h: Same.
* include/parallel/checkers.h: Same.
* include/parallel/random_number.h: Same.

* include/c_global/csignal: Change # to \#.
* include/c_global/cstdlib: Same.
* include/c_global/cstdio: Same.
* include/c_global/cstdarg: Same.
* include/c_global/cctype: Same.
* include/c_global/cerrno: Same.
* include/c_global/cstdatomic: Same.
* include/c_global/cmath: Same.
* include/c_global/ciso646: Same.
* include/c_global/ctime: Same.
* include/c_global/clocale: Same.
* include/c_global/climits: Same.
* include/c_global/cassert: Same.
* include/c_global/csetjmp: Same.
* include/c_global/cwchar: Same.
* include/c_global/cfloat: Same.
* include/c_global/cstring: Same.
* include/c_global/cstddef: Same.
* include/c_global/cwctype: Same.

* include/std/memory: Only dance around boost_sp_counted_base.h.
* include/tr1_impl/boost_sp_counted_base.h: Add markup.
* include/tr1/shared_ptr.h: Strip markup.
* include/bits/shared_ptr.h: Move base types...
* include/bits/shared_ptr_base.h: ...here.
* include/Makefile.am: Add.
* include/Makefile.in: Regenerate.
* configure: Same.
* testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
Adjust line numbers.
* testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.

From-SVN: r153980

64 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/configure
libstdc++-v3/doc/doxygen/doxygroups.cc
libstdc++-v3/doc/doxygen/user.cfg.in
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/shared_ptr.h
libstdc++-v3/include/bits/shared_ptr_base.h [new file with mode: 0644]
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/bits/stl_iterator_base_types.h
libstdc++-v3/include/bits/stl_tempbuf.h
libstdc++-v3/include/bits/stream_iterator.h
libstdc++-v3/include/bits/streambuf_iterator.h
libstdc++-v3/include/c_global/cassert
libstdc++-v3/include/c_global/cctype
libstdc++-v3/include/c_global/cerrno
libstdc++-v3/include/c_global/cfloat
libstdc++-v3/include/c_global/ciso646
libstdc++-v3/include/c_global/climits
libstdc++-v3/include/c_global/clocale
libstdc++-v3/include/c_global/cmath
libstdc++-v3/include/c_global/csetjmp
libstdc++-v3/include/c_global/csignal
libstdc++-v3/include/c_global/cstdarg
libstdc++-v3/include/c_global/cstdatomic
libstdc++-v3/include/c_global/cstddef
libstdc++-v3/include/c_global/cstdio
libstdc++-v3/include/c_global/cstdlib
libstdc++-v3/include/c_global/cstring
libstdc++-v3/include/c_global/ctime
libstdc++-v3/include/c_global/cwchar
libstdc++-v3/include/c_global/cwctype
libstdc++-v3/include/parallel/balanced_quicksort.h
libstdc++-v3/include/parallel/base.h
libstdc++-v3/include/parallel/checkers.h
libstdc++-v3/include/parallel/compatibility.h
libstdc++-v3/include/parallel/equally_split.h
libstdc++-v3/include/parallel/for_each.h
libstdc++-v3/include/parallel/list_partition.h
libstdc++-v3/include/parallel/merge.h
libstdc++-v3/include/parallel/multiway_merge.h
libstdc++-v3/include/parallel/multiway_mergesort.h
libstdc++-v3/include/parallel/queue.h
libstdc++-v3/include/parallel/random_number.h
libstdc++-v3/include/parallel/random_shuffle.h
libstdc++-v3/include/parallel/workstealing.h
libstdc++-v3/include/profile/impl/profiler_hashtable_size.h
libstdc++-v3/include/profile/impl/profiler_state.h
libstdc++-v3/include/std/iosfwd
libstdc++-v3/include/std/limits
libstdc++-v3/include/std/memory
libstdc++-v3/include/std/sstream
libstdc++-v3/include/std/streambuf
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/std/utility
libstdc++-v3/include/tr1/shared_ptr.h
libstdc++-v3/include/tr1_impl/boost_sp_counted_base.h
libstdc++-v3/include/tr1_impl/regex
libstdc++-v3/include/tr1_impl/type_traits
libstdc++-v3/libsupc++/cxxabi.h
libstdc++-v3/libsupc++/exception
libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc
libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc

index ec39612f8f519a7cf380e36c98902120347c20bc..8661b23700d7f7ca536e77a234fdbe6b49e71794 100644 (file)
@@ -1,3 +1,75 @@
+2009-11-06  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * doc/doxygen/user.cfg.in: Adjust includes.
+
+       * doc/doxygen/doxygroups.cc: Move group markup.
+       * include/tr1_impl/regex: Change " to '. Add group markup.
+       * include/std/utility: Same.
+       * include/std/type_traits: Same.
+       * include/std/streambuf: Same.
+       * include/std/iosfwd: Same.
+       * include/std/limits: Same.
+       * include/std/sstream: Same.
+       * include/profile/impl/profiler_state.h: Same.
+       * include/profile/impl/profiler_hashtable_size.h: Same.
+       * include/bits/stl_algobase.h: Same.
+       * include/bits/stl_iterator_base_types.h: Same.
+       * include/bits/stream_iterator.h: Same.
+       * include/bits/stl_iterator.h: Same.
+       * include/bits/stl_tempbuf.h: Same.
+       * include/bits/streambuf_iterator.h: Same.
+       * libsupc++/exception: Same.
+       * libsupc++/cxxabi.h: Same.
+       * include/tr1_impl/type_traits: Same.
+
+       * include/parallel/multiway_merge.h: Change @__c to @c, @__f to @f.
+       * include/parallel/list_partition.h: Same.
+       * include/parallel/for_each.h: Same.
+       * include/parallel/workstealing.h: Same.
+       * include/parallel/base.h: Same.
+       * include/parallel/equally_split.h: Same.
+       * include/parallel/random_shuffle.h: Same.
+       * include/parallel/balanced_quicksort.h: Same.
+       * include/parallel/merge.h: Same.
+       * include/parallel/multiway_mergesort.h: Same.
+       * include/parallel/compatibility.h: Same.
+       * include/parallel/queue.h: Same.
+       * include/parallel/checkers.h: Same.
+       * include/parallel/random_number.h: Same.
+
+
+       * include/c_global/csignal: Change # to \#.
+       * include/c_global/cstdlib: Same.
+       * include/c_global/cstdio: Same.
+       * include/c_global/cstdarg: Same.
+       * include/c_global/cctype: Same.
+       * include/c_global/cerrno: Same.
+       * include/c_global/cstdatomic: Same.
+       * include/c_global/cmath: Same.
+       * include/c_global/ciso646: Same.
+       * include/c_global/ctime: Same.
+       * include/c_global/clocale: Same.
+       * include/c_global/climits: Same.
+       * include/c_global/cassert: Same.
+       * include/c_global/csetjmp: Same.
+       * include/c_global/cwchar: Same.
+       * include/c_global/cfloat: Same.
+       * include/c_global/cstring: Same.
+       * include/c_global/cstddef: Same.
+       * include/c_global/cwctype: Same.
+
+       * include/std/memory: Only dance around boost_sp_counted_base.h.
+       * include/tr1_impl/boost_sp_counted_base.h: Add markup.
+       * include/tr1/shared_ptr.h: Strip markup.
+       * include/bits/shared_ptr.h: Move base types...
+       * include/bits/shared_ptr_base.h: ...here.
+       * include/Makefile.am: Add.
+       * include/Makefile.in: Regenerate.
+       * configure: Same.
+       * testsuite/20_util/make_signed/requirements/typedefs_neg.cc:
+       Adjust line numbers.
+       * testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc: Same.
+
 2009-11-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        * include/parallel/multiway_merge.h: Simple formatting and
index e34b0c4bee8b107c3dd4941950bd58196c9e2b45..75adc589e12ceb9639978a27b48355c5ce2f15c6 100755 (executable)
@@ -19542,7 +19542,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -26444,7 +26444,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -32259,7 +32259,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -43904,7 +43904,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -44118,7 +44118,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -44593,7 +44593,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -50762,7 +50762,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -56562,7 +56562,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -56729,7 +56729,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -56878,7 +56878,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -57045,7 +57045,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
@@ -57217,7 +57217,7 @@ $as_echo_n "checking for ld version... " >&6; }
       glibcxx_ld_is_gold=yes
     fi
     ldver=`$LD --version 2>/dev/null |
-          sed -e 's/GNU gold /GNU ld/;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
+          sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
 
     glibcxx_gnu_ld_version=`echo $ldver | \
            $AWK -F. '{ if (NF<3) $3=0; print ($1*100+$2)*100+$3 }'`
index d11fb3bd2d136f4122b63556647a6fc643e60900..e7c664a92fb142ad02b083416027d94edc076d65 100644 (file)
@@ -149,10 +149,3 @@ summarized in <a href="tables.html">tables</a>.  */
  * Components for concurrent operations, including threads, mutexes,
  * and condition variables.
  */
-
-/**
- * @defgroup pointer_abstractions Pointer Abstractions
- * @ingroup memory
- *
- * Components for memory allocation, deallocation, and management.
- */
index a26c5450e79c352a1fafd1a668f886582ee6f093..b6b9b38ea97dd54fa3a5fbc931a2eb6ee842443a 100644 (file)
@@ -669,17 +669,6 @@ INPUT                  = @srcdir@/doc/doxygen/doxygroups.cc \
                          include/profile/unordered_map \
                          include/profile/unordered_set \
                          include/profile/vector \
-                         include/profile/base.h \
-                         include/profile/impl/profiler.h \
-                         include/profile/impl/profiler_container_size.h \
-                         include/profile/impl/profiler_hash_func.h \
-                         include/profile/impl/profiler_hashtable_size.h \
-                         include/profile/impl/profiler_map_to_unordered_map.h \
-                         include/profile/impl/profiler_node.h \
-                         include/profile/impl/profiler_state.h \
-                         include/profile/impl/profiler_trace.h \
-                         include/profile/impl/profiler_vector_size.h \
-                         include/profile/impl/profiler_vector_to_list.h \
                          include/ext/algorithm \
                          include/ext/functional \
                          include/ext/iterator \
@@ -720,7 +709,6 @@ INPUT                  = @srcdir@/doc/doxygen/doxygroups.cc \
                          include/tr1_impl/cwctype \
                          include/tr1_impl/functional \
                          include/tr1_impl/hashtable \
-                         include/tr1_impl/random \
                          include/tr1_impl/regex \
                          include/tr1_impl/type_traits \
                          include/tr1_impl/unordered_map \
@@ -732,10 +720,10 @@ INPUT                  = @srcdir@/doc/doxygen/doxygroups.cc \
                          include/@host_alias@/bits \
                          include/backward \
                          include/bits \
-                         include/bits/shared_ptr.h \
                          include/debug \
                          include/parallel \
                          include/profile \
+                         include/profile/impl \
                          include/ext \
                          include/ext/pb_ds \
                          include/ext/pb_ds/detail 
index 196ccb9911fd74e76af734960af504d5bc625a80..1cea8a24e94efb86e3bb734ae23b343566afca94 100644 (file)
@@ -121,6 +121,7 @@ bits_headers = \
        ${bits_srcdir}/stream_iterator.h \
        ${bits_srcdir}/streambuf_iterator.h \
        ${bits_srcdir}/shared_ptr.h \
+       ${bits_srcdir}/shared_ptr_base.h \
        ${bits_srcdir}/slice_array.h \
        ${bits_srcdir}/sstream.tcc \
        ${bits_srcdir}/stl_algo.h \
index b1c457e2ea62d7169c3eaf3aea1b2cf423dad90a..a1fab9adfbe4ae1a2d1ae6329870fe985f1e34e6 100644 (file)
@@ -364,6 +364,7 @@ bits_headers = \
        ${bits_srcdir}/stream_iterator.h \
        ${bits_srcdir}/streambuf_iterator.h \
        ${bits_srcdir}/shared_ptr.h \
+       ${bits_srcdir}/shared_ptr_base.h \
        ${bits_srcdir}/slice_array.h \
        ${bits_srcdir}/sstream.tcc \
        ${bits_srcdir}/stl_algo.h \
index 81bef58594043697b4e75e561babcb14878e11a2..796df14c2c477ad9fcede2bb11ea68e30f716684 100644 (file)
@@ -22,6 +22,8 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+// GCC Note: Based on files from version 1.32.0 of the Boost library.
+
 //  shared_count.hpp
 //  Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
 
@@ -39,8 +41,6 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-// GCC Note:  based on version 1.32.0 of the Boost library.
-
 /** @file bits/shared_ptr.h
  *  This is an internal header file, included by other library headers.
  *  You should not attempt to use it directly.
@@ -53,9 +53,7 @@
 # include <c++0x_warning.h>
 #endif
 
-#if defined(_GLIBCXX_INCLUDE_AS_TR1)
-#  error C++0x header cannot be included from TR1 header
-#endif
+#include <bits/shared_ptr_base.h>
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
@@ -64,563 +62,89 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    * @{
    */
 
-  // counted ptr with no deleter or allocator support
-  template<typename _Ptr, _Lock_policy _Lp>
-    class _Sp_counted_ptr
-    : public _Sp_counted_base<_Lp>
-    {
-    public:
-      _Sp_counted_ptr(_Ptr __p)
-      : _M_ptr(__p) { }
-    
-      virtual void
-      _M_dispose() // nothrow
-      { delete _M_ptr; }
-      
-      virtual void
-      _M_destroy() // nothrow
-      { delete this; }
-      
-      virtual void*
-      _M_get_deleter(const std::type_info& __ti)
-      { return 0; }
-      
-      _Sp_counted_ptr(const _Sp_counted_ptr&) = delete;
-      _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete;
-      
-    protected:
-      _Ptr             _M_ptr;  // copy constructor must not throw
-    };
-
-  // support for custom deleter and/or allocator
-  template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp>
-    class _Sp_counted_deleter
-    : public _Sp_counted_ptr<_Ptr, _Lp>
-    {
-      typedef typename _Alloc::template
-          rebind<_Sp_counted_deleter>::other _My_alloc_type;
-
-      // Helper class that stores the Deleter and also acts as an allocator.
-      // Used to dispose of the owned pointer and the internal refcount
-      // Requires that copies of _Alloc can free each other's memory.
-      struct _My_Deleter
-      : public _My_alloc_type    // copy constructor must not throw
-      {
-        _Deleter _M_del;         // copy constructor must not throw
-        _My_Deleter(_Deleter __d, const _Alloc& __a)
-          : _My_alloc_type(__a), _M_del(__d) { }
-      };
-
-    protected:
-      typedef _Sp_counted_ptr<_Ptr, _Lp> _Base_type;
-
-    public:
-      /**
-       *  @brief   
-       *  @pre     __d(__p) must not throw.
-       */
-      _Sp_counted_deleter(_Ptr __p, _Deleter __d)
-      : _Base_type(__p), _M_del(__d, _Alloc()) { }
-    
-      /**
-       *  @brief   
-       *  @pre     __d(__p) must not throw.
-       */
-      _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a)
-      : _Base_type(__p), _M_del(__d, __a) { }
-    
-      virtual void
-      _M_dispose() // nothrow
-      { _M_del._M_del(_Base_type::_M_ptr); }
-      
-      virtual void
-      _M_destroy() // nothrow
-      {
-        _My_alloc_type __a(_M_del);
-        this->~_Sp_counted_deleter();
-        __a.deallocate(this, 1);
-      }
-      
-      virtual void*
-      _M_get_deleter(const std::type_info& __ti)
-      { return __ti == typeid(_Deleter) ? &_M_del._M_del : 0; }
-      
-    protected:
-      _My_Deleter      _M_del;  // copy constructor must not throw
-    };
-
-  // helpers for make_shared / allocate_shared
-
-  template<typename _Tp>
-    struct _Sp_destroy_inplace
-    {
-      void operator()(_Tp* __p) const { if (__p) __p->~_Tp(); }
-    };
-
-  struct _Sp_make_shared_tag { };
-
-  template<typename _Tp, typename _Alloc, _Lock_policy _Lp>
-    class _Sp_counted_ptr_inplace
-    : public _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
-    {
-      typedef _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
-        _Base_type;
-
-    public:
-      _Sp_counted_ptr_inplace(_Alloc __a)
-      : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
-      , _M_storage()
-      {
-        void* __p = &_M_storage;
-        ::new (__p) _Tp();  // might throw
-        _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
-      }
-
-      template<typename... _Args>
-        _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args)
-        : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
-        , _M_storage()
-        {
-          void* __p = &_M_storage;
-          ::new (__p) _Tp(std::forward<_Args>(__args)...);  // might throw
-          _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
-        }
-
-      // override because the allocator needs to know the dynamic type
-      virtual void
-      _M_destroy() // nothrow
-      {
-        typedef typename _Alloc::template
-            rebind<_Sp_counted_ptr_inplace>::other _My_alloc_type;
-        _My_alloc_type __a(_Base_type::_M_del);
-        this->~_Sp_counted_ptr_inplace();
-        __a.deallocate(this, 1);
-      }
-
-      // sneaky trick so __shared_ptr can get the managed pointer
-      virtual void*
-      _M_get_deleter(const std::type_info& __ti)
-      {
-        return __ti == typeid(_Sp_make_shared_tag)
-               ? static_cast<void*>(&_M_storage)
-               : _Base_type::_M_get_deleter(__ti);
-      }
-      
-    private:
-      typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type
-        _M_storage;
-    };
-
-  template<_Lock_policy _Lp = __default_lock_policy>
-    class __weak_count;
-
-  template<_Lock_policy _Lp = __default_lock_policy>
-    class __shared_count
-    {
-    public: 
-      __shared_count()
-      : _M_pi(0) // nothrow
-      { }
-  
-      template<typename _Ptr>
-        __shared_count(_Ptr __p) : _M_pi(0)
-        {
-          __try
-            {
-              _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p);
-            }
-          __catch(...)
-            {
-              delete __p;
-              __throw_exception_again;
-            }
-        }
-
-      template<typename _Ptr, typename _Deleter>
-        __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)
-        {
-          // allocator's value_type doesn't matter, will rebind it anyway
-          typedef std::allocator<int> _Alloc;
-          typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
-          typedef std::allocator<_Sp_cd_type> _Alloc2;
-          _Alloc2 __a2;
-          __try
-            {
-              _M_pi = __a2.allocate(1);
-              ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d);
-            }
-          __catch(...)
-            {
-              __d(__p); // Call _Deleter on __p.
-              if (_M_pi)
-                __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
-              __throw_exception_again;
-            }
-        }
-
-      template<typename _Ptr, typename _Deleter, typename _Alloc>
-        __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0)
-        {
-          typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
-          typedef typename _Alloc::template rebind<_Sp_cd_type>::other _Alloc2;
-          _Alloc2 __a2(__a);
-          __try
-            {
-              _M_pi = __a2.allocate(1);
-              ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d, __a);
-            }
-          __catch(...)
-            {
-              __d(__p); // Call _Deleter on __p.
-              if (_M_pi)
-                __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
-              __throw_exception_again;
-            }
-        }
-
-      template<typename _Tp, typename _Alloc, typename... _Args>
-        __shared_count(_Sp_make_shared_tag, _Tp*, _Alloc __a, _Args&&... __args)
-        : _M_pi(0)
-        {
-          typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type;
-          typedef typename _Alloc::template rebind<_Sp_cp_type>::other _Alloc2;
-          _Alloc2 __a2(__a);
-          __try
-            {
-              _M_pi = __a2.allocate(1);
-              ::new(static_cast<void*>(_M_pi)) _Sp_cp_type(__a,
-                    std::forward<_Args>(__args)...);
-            }
-          __catch(...)
-            {
-              if (_M_pi)
-               __a2.deallocate(static_cast<_Sp_cp_type*>(_M_pi), 1);
-              __throw_exception_again;
-            }
-        }
-
-#if _GLIBCXX_DEPRECATED
-      // Special case for auto_ptr<_Tp> to provide the strong guarantee.
-      template<typename _Tp>
-        explicit
-        __shared_count(std::auto_ptr<_Tp>&& __r)
-        : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
-        { __r.release(); }
-#endif
-
-      // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee.
-      template<typename _Tp, typename _Del>
-        explicit
-        __shared_count(std::unique_ptr<_Tp, _Del>&& __r)
-        : _M_pi(_S_create_from_up(std::move(__r)))
-        { __r.release(); }
-
-      // Throw bad_weak_ptr when __r._M_get_use_count() == 0.
-      explicit
-      __shared_count(const __weak_count<_Lp>& __r);
-  
-      ~__shared_count() // nothrow
-      {
-        if (_M_pi != 0)
-          _M_pi->_M_release();
-      }
-
-      __shared_count(const __shared_count& __r)
-      : _M_pi(__r._M_pi) // nothrow
-      {
-        if (_M_pi != 0)
-          _M_pi->_M_add_ref_copy();
-      }
-  
-      __shared_count&
-      operator=(const __shared_count& __r) // nothrow
-      {
-        _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
-        if (__tmp != _M_pi)
-          {
-            if (__tmp != 0)
-              __tmp->_M_add_ref_copy();
-            if (_M_pi != 0)
-              _M_pi->_M_release();
-            _M_pi = __tmp;
-          }
-        return *this;
-      }
-  
-      void
-      _M_swap(__shared_count& __r) // nothrow
-      {
-        _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
-        __r._M_pi = _M_pi;
-        _M_pi = __tmp;
-      }
-  
-      long
-      _M_get_use_count() const // nothrow
-      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
-
-      bool
-      _M_unique() const // nothrow
-      { return this->_M_get_use_count() == 1; }
-
-      void*
-      _M_get_deleter(const std::type_info& __ti) const
-      { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }
-
-      bool
-      _M_less(const __shared_count& __rhs) const
-      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
-
-      bool
-      _M_less(const __weak_count<_Lp>& __rhs) const
-      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
-
-      // friend function injected into enclosing namespace and found by ADL
-      friend inline bool
-      operator==(const __shared_count& __a, const __shared_count& __b)
-      { return __a._M_pi == __b._M_pi; }
-  
-    private:
-      friend class __weak_count<_Lp>;
-
-      template<typename _Tp, typename _Del>
-        static _Sp_counted_base<_Lp>*
-        _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
-          typename std::enable_if<!std::is_reference<_Del>::value>::type* = 0)
-        {
-          return new _Sp_counted_deleter<_Tp*, _Del, std::allocator<_Tp>,
-            _Lp>(__r.get(), __r.get_deleter());
-        }
-
-      template<typename _Tp, typename _Del>
-        static _Sp_counted_base<_Lp>*
-        _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
-          typename std::enable_if<std::is_reference<_Del>::value>::type* = 0)
-        {
-          typedef typename std::remove_reference<_Del>::type _Del1;
-          typedef std::reference_wrapper<_Del1> _Del2;
-          return new _Sp_counted_deleter<_Tp*, _Del2, std::allocator<_Tp>,
-            _Lp>(__r.get(), std::ref(__r.get_deleter()));
-        }
-
-      _Sp_counted_base<_Lp>*  _M_pi;
-    };
-
-
-  template<_Lock_policy _Lp>
-    class __weak_count
-    {
-    public:
-      __weak_count()
-      : _M_pi(0) // nothrow
-      { }
-  
-      __weak_count(const __shared_count<_Lp>& __r)
-      : _M_pi(__r._M_pi) // nothrow
-      {
-       if (_M_pi != 0)
-         _M_pi->_M_weak_add_ref();
-      }
-      
-      __weak_count(const __weak_count<_Lp>& __r)
-      : _M_pi(__r._M_pi) // nothrow
-      {
-       if (_M_pi != 0)
-         _M_pi->_M_weak_add_ref();
-      }
-      
-      ~__weak_count() // nothrow
-      {
-       if (_M_pi != 0)
-         _M_pi->_M_weak_release();
-      }
-      
-      __weak_count<_Lp>&
-      operator=(const __shared_count<_Lp>& __r) // nothrow
-      {
-       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
-       if (__tmp != 0)
-         __tmp->_M_weak_add_ref();
-       if (_M_pi != 0)
-         _M_pi->_M_weak_release();
-       _M_pi = __tmp;  
-       return *this;
-      }
-      
-      __weak_count<_Lp>&
-      operator=(const __weak_count<_Lp>& __r) // nothrow
-      {
-       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
-       if (__tmp != 0)
-         __tmp->_M_weak_add_ref();
-       if (_M_pi != 0)
-         _M_pi->_M_weak_release();
-       _M_pi = __tmp;
-       return *this;
-      }
-
-      void
-      _M_swap(__weak_count<_Lp>& __r) // nothrow
-      {
-       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
-       __r._M_pi = _M_pi;
-       _M_pi = __tmp;
-      }
-  
-      long
-      _M_get_use_count() const // nothrow
-      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
-
-      bool
-      _M_less(const __weak_count& __rhs) const
-      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
-
-      bool
-      _M_less(const __shared_count<_Lp>& __rhs) const
-      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
-
-      // friend function injected into enclosing namespace and found by ADL
-      friend inline bool
-      operator==(const __weak_count& __a, const __weak_count& __b)
-      { return __a._M_pi == __b._M_pi; }
-
-    private:
-      friend class __shared_count<_Lp>;
-
-      _Sp_counted_base<_Lp>*  _M_pi;
-    };
-
-  // now that __weak_count is defined we can define this constructor:
-  template<_Lock_policy _Lp>
-    inline
-    __shared_count<_Lp>::
-    __shared_count(const __weak_count<_Lp>& __r)
-    : _M_pi(__r._M_pi)
+  /// 2.2.3.7 shared_ptr I/O
+  template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
+    std::basic_ostream<_Ch, _Tr>&
+    operator<<(std::basic_ostream<_Ch, _Tr>& __os,
+              const __shared_ptr<_Tp, _Lp>& __p)
     {
-      if (_M_pi != 0)
-       _M_pi->_M_add_ref_lock();
-      else
-       __throw_bad_weak_ptr();
+      __os << __p.get();
+      return __os;
     }
 
-  // Forward declarations.
-  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
-    class __shared_ptr;
-  
-  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
-    class __weak_ptr;
-
-  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
-    class __enable_shared_from_this;
+  /// 2.2.3.10 shared_ptr get_deleter (experimental)
+  template<typename _Del, typename _Tp, _Lock_policy _Lp>
+    inline _Del*
+    get_deleter(const __shared_ptr<_Tp, _Lp>& __p)
+    { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); }
 
-  template<typename _Tp>
-    class shared_ptr;
-  
-  template<typename _Tp>
-    class weak_ptr;
 
+  /**
+   *  @brief  A smart pointer with reference-counted copy semantics.
+   *
+   *  The object pointed to is deleted when the last shared_ptr pointing to
+   *  it is destroyed or reset.
+  */
   template<typename _Tp>
-    class enable_shared_from_this;
-
-  // Support for enable_shared_from_this.
-
-  // Friend of __enable_shared_from_this.
-  template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
-    void
-    __enable_shared_from_this_helper(const __shared_count<_Lp>&,
-                                    const __enable_shared_from_this<_Tp1,
-                                    _Lp>*, const _Tp2*);
-
-  // Friend of enable_shared_from_this.
-  template<typename _Tp1, typename _Tp2>
-    void
-    __enable_shared_from_this_helper(const __shared_count<>&,
-                                    const enable_shared_from_this<_Tp1>*,
-                                    const _Tp2*);
-
-  template<_Lock_policy _Lp>
-    inline void
-    __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)
-    { }
-
-
-  template<typename _Tp, _Lock_policy _Lp>
-    class __shared_ptr
+    class shared_ptr : public __shared_ptr<_Tp>
     {
     public:
-      typedef _Tp   element_type;
-      
-      /** @brief  Construct an empty %__shared_ptr.
+      /**
+       *  @brief  Construct an empty %shared_ptr.
        *  @post   use_count()==0 && get()==0
        */
-      __shared_ptr()
-      : _M_ptr(0), _M_refcount() // never throws
-      { }
+      shared_ptr() : __shared_ptr<_Tp>() { }
 
-      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p.
+      /**
+       *  @brief  Construct a %shared_ptr that owns the pointer @a __p.
        *  @param  __p  A pointer that is convertible to element_type*.
        *  @post   use_count() == 1 && get() == __p
        *  @throw  std::bad_alloc, in which case @c delete @a __p is called.
        */
       template<typename _Tp1>
-        explicit
-        __shared_ptr(_Tp1* __p)
-       : _M_ptr(__p), _M_refcount(__p)
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         // __glibcxx_function_requires(_CompleteConcept<_Tp1*>)
-         __enable_shared_from_this_helper(_M_refcount, __p, __p);
-       }
+       explicit shared_ptr(_Tp1* __p) : __shared_ptr<_Tp>(__p) { }
 
-      //
-      // Requirements: _Deleter's copy constructor and destructor must
-      // not throw
-      //
-      // __shared_ptr will release __p by calling __d(__p)
-      //
-      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p
+      /**
+       *  @brief  Construct a %shared_ptr that owns the pointer @a __p
        *          and the deleter @a __d.
        *  @param  __p  A pointer.
        *  @param  __d  A deleter.
        *  @post   use_count() == 1 && get() == __p
        *  @throw  std::bad_alloc, in which case @a __d(__p) is called.
+       *
+       *  Requirements: _Deleter's copy constructor and destructor must
+       *  not throw
+       *
+       *  __shared_ptr will release __p by calling __d(__p)
        */
-      template<typename _Tp1, typename _Deleter>
-        __shared_ptr(_Tp1* __p, _Deleter __d)
-        : _M_ptr(__p), _M_refcount(__p, __d)
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
-         __enable_shared_from_this_helper(_M_refcount, __p, __p);
-       }
-      
-      //
-      // Requirements: _Deleter's copy constructor and destructor must
-      // not throw _Alloc's copy constructor and destructor must not
-      // throw.
-      //
-      // __shared_ptr will release __p by calling __d(__p)
-      //
-      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p
+       template<typename _Tp1, typename _Deleter>
+       shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { }
+
+      /**
+       *  @brief  Construct a %shared_ptr that owns the pointer @a __p
        *          and the deleter @a __d.
        *  @param  __p  A pointer.
        *  @param  __d  A deleter.
        *  @param  __a  An allocator.
        *  @post   use_count() == 1 && get() == __p
        *  @throw  std::bad_alloc, in which case @a __d(__p) is called.
+       *
+       *  Requirements: _Deleter's copy constructor and destructor must
+       *  not throw _Alloc's copy constructor and destructor must not
+       *  throw.
+       *
+       *  __shared_ptr will release __p by calling __d(__p)
        */
       template<typename _Tp1, typename _Deleter, typename _Alloc>
-        __shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
-       : _M_ptr(__p), _M_refcount(__p, __d, __a)
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
-         __enable_shared_from_this_helper(_M_refcount, __p, __p);
-       }
+       shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+       : __shared_ptr<_Tp>(__p, __d, __a) { }
+
+      // Aliasing constructor
 
-      /** @brief  Constructs a %__shared_ptr instance that stores @a __p
+      /**
+       *  @brief  Constructs a %shared_ptr instance that stores @a __p
        *          and shares ownership with @a __r.
-       *  @param  __r  A %__shared_ptr.
+       *  @param  __r  A %shared_ptr.
        *  @param  __p  A pointer that will remain valid while @a *__r is valid.
        *  @post   get() == __p && use_count() == __r.use_count()
        *
@@ -634,48 +158,38 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        * @endcode
        */
       template<typename _Tp1>
-        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p)
-       : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
-        { }
-
-      //  generated copy constructor, assignment, destructor are fine.
-      
-      /** @brief  If @a __r is empty, constructs an empty %__shared_ptr;
-       *          otherwise construct a %__shared_ptr that shares ownership
+       shared_ptr(const shared_ptr<_Tp1>& __r, _Tp* __p)
+       : __shared_ptr<_Tp>(__r, __p) { }
+
+      /**
+       *  @brief  If @a __r is empty, constructs an empty %shared_ptr;
+       *          otherwise construct a %shared_ptr that shares ownership
        *          with @a __r.
-       *  @param  __r  A %__shared_ptr.
+       *  @param  __r  A %shared_ptr.
        *  @post   get() == __r.get() && use_count() == __r.use_count()
        */
       template<typename _Tp1>
-        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
-       : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
-        { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+       shared_ptr(const shared_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { }
 
-      /** @brief  Move-constructs a %__shared_ptr instance from @a __r.
-       *  @param  __r  A %__shared_ptr rvalue.
+      /**
+       *  @brief  Move-constructs a %shared_ptr instance from @a __r.
+       *  @param  __r  A %shared_ptr rvalue.
        *  @post   *this contains the old value of @a __r, @a __r is empty.
        */
-      __shared_ptr(__shared_ptr&& __r)
-      : _M_ptr(__r._M_ptr), _M_refcount() // never throws
-      {
-        _M_refcount._M_swap(__r._M_refcount);
-        __r._M_ptr = 0;
-      }
+      shared_ptr(shared_ptr&& __r)
+      : __shared_ptr<_Tp>(std::move(__r)) { }
 
-      /** @brief  Move-constructs a %__shared_ptr instance from @a __r.
-       *  @param  __r  A %__shared_ptr rvalue.
+      /**
+       *  @brief  Move-constructs a %shared_ptr instance from @a __r.
+       *  @param  __r  A %shared_ptr rvalue.
        *  @post   *this contains the old value of @a __r, @a __r is empty.
        */
       template<typename _Tp1>
-        __shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r)
-       : _M_ptr(__r._M_ptr), _M_refcount() // never throws
-        {
-          __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-          _M_refcount._M_swap(__r._M_refcount);
-          __r._M_ptr = 0;
-        }
-
-      /** @brief  Constructs a %__shared_ptr that shares ownership with @a __r
+       shared_ptr(shared_ptr<_Tp1>&& __r)
+       : __shared_ptr<_Tp>(std::move(__r)) { }
+
+      /**
+       *  @brief  Constructs a %shared_ptr that shares ownership with @a __r
        *          and stores a copy of the pointer stored in @a __r.
        *  @param  __r  A weak_ptr.
        *  @post   use_count() == __r.use_count()
@@ -683,609 +197,36 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *          in which case the constructor has no effect.
        */
       template<typename _Tp1>
-        explicit
-        __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
-       : _M_refcount(__r._M_refcount) // may throw
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         // It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount)
-         // did not throw.
-         _M_ptr = __r._M_ptr;
-       }
-
-      template<typename _Tp1, typename _Del>
-        explicit
-        __shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
-
-      /**
-       * If an exception is thrown this constructor has no effect.
-       */
-      template<typename _Tp1, typename _Del>
-        explicit
-        __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
-       : _M_ptr(__r.get()), _M_refcount()
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         _Tp1* __tmp = __r.get();
-         _M_refcount = __shared_count<_Lp>(std::move(__r));
-         __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
-       }
-
-#if _GLIBCXX_DEPRECATED
-      /**
-       * @post use_count() == 1 and __r.get() == 0
-       */
-      template<typename _Tp1>
-        explicit
-        __shared_ptr(std::auto_ptr<_Tp1>&& __r)
-       : _M_ptr(__r.get()), _M_refcount()
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         // TODO requires _Tp1 is complete, delete __r.release() well-formed
-         _Tp1* __tmp = __r.get();
-         _M_refcount = __shared_count<_Lp>(std::move(__r));
-         __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
-       }
-#endif
-
-      template<typename _Tp1>
-        __shared_ptr&
-        operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
-        {
-         _M_ptr = __r._M_ptr;
-         _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw
-         return *this;
-       }
-
-#if _GLIBCXX_DEPRECATED
-      template<typename _Tp1>
-        __shared_ptr&
-        operator=(std::auto_ptr<_Tp1>&& __r)
-        {
-         __shared_ptr(std::move(__r)).swap(*this);
-         return *this;
-       }
-#endif
-
-      __shared_ptr&
-      operator=(__shared_ptr&& __r)
-      {
-        __shared_ptr(std::move(__r)).swap(*this);
-        return *this;
-      }
-     
-      template<class _Tp1>
-        __shared_ptr&
-        operator=(__shared_ptr<_Tp1, _Lp>&& __r)
-        {
-          __shared_ptr(std::move(__r)).swap(*this);
-          return *this;
-        }
-
-      template<typename _Tp1, typename _Del>
-        __shared_ptr&
-        operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
-
-      template<typename _Tp1, typename _Del>
-        __shared_ptr&
-        operator=(std::unique_ptr<_Tp1, _Del>&& __r)
-        {
-         __shared_ptr(std::move(__r)).swap(*this);
-         return *this;
-        }
-
-      void
-      reset() // never throws
-      { __shared_ptr().swap(*this); }
-
-      template<typename _Tp1>
-        void
-        reset(_Tp1* __p) // _Tp1 must be complete.
-        {
-         // Catch self-reset errors.
-         _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); 
-         __shared_ptr(__p).swap(*this);
-       }
-
-      template<typename _Tp1, typename _Deleter>
-        void
-        reset(_Tp1* __p, _Deleter __d)
-        { __shared_ptr(__p, __d).swap(*this); }
-
-      template<typename _Tp1, typename _Deleter, typename _Alloc>
-        void
-        reset(_Tp1* __p, _Deleter __d, const _Alloc& __a)
-        { __shared_ptr(__p, __d, __a).swap(*this); }
-
-      // Allow class instantiation when _Tp is [cv-qual] void.
-      typename std::add_lvalue_reference<_Tp>::type
-      operator*() const // never throws
-      {
-       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
-       return *_M_ptr;
-      }
-
-      _Tp*
-      operator->() const // never throws
-      {
-       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
-       return _M_ptr;
-      }
-    
-      _Tp*
-      get() const // never throws
-      { return _M_ptr; }
-
-      explicit operator bool() const // never throws
-      { return _M_ptr == 0 ? false : true; }
-
-      bool
-      unique() const // never throws
-      { return _M_refcount._M_unique(); }
-
-      long
-      use_count() const // never throws
-      { return _M_refcount._M_get_use_count(); }
-
-      void
-      swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
-      {
-       std::swap(_M_ptr, __other._M_ptr);
-       _M_refcount._M_swap(__other._M_refcount);
-      }
-
-      template<typename _Tp1>
-        bool
-        owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const
-        { return _M_refcount._M_less(__rhs._M_refcount); }
-
-      template<typename _Tp1>
-        bool
-        owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const
-        { return _M_refcount._M_less(__rhs._M_refcount); }
-
-    protected:
-      // This constructor is non-standard, it is used by allocate_shared.
-      template<typename _Alloc, typename... _Args>
-        __shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
-        : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
-                               std::forward<_Args>(__args)...)
-        {
-          // _M_ptr needs to point to the newly constructed object.
-          // This relies on _Sp_counted_ptr_inplace::_M_get_deleter.
-          void* __p = _M_refcount._M_get_deleter(typeid(__tag));
-          _M_ptr = static_cast<_Tp*>(__p);
-         __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
-        }
-
-      template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
-               typename... _Args>
-        friend __shared_ptr<_Tp1, _Lp1>
-        __allocate_shared(_Alloc __a, _Args&&... __args);
-
-    private:
-      void*
-      _M_get_deleter(const std::type_info& __ti) const
-      { return _M_refcount._M_get_deleter(__ti); }
-
-      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
-      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
-
-      template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
-        friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);
-
-      _Tp*                _M_ptr;         // Contained pointer.
-      __shared_count<_Lp>  _M_refcount;    // Reference counter.
-    };
-
-  // 20.8.13.2.7 shared_ptr comparisons
-  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
-    inline bool
-    operator==(const __shared_ptr<_Tp1, _Lp>& __a,
-        const __shared_ptr<_Tp2, _Lp>& __b)
-    { return __a.get() == __b.get(); }
-
-  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
-    inline bool
-    operator!=(const __shared_ptr<_Tp1, _Lp>& __a,
-        const __shared_ptr<_Tp2, _Lp>& __b)
-    { return __a.get() != __b.get(); }
-
-  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
-    inline bool
-    operator<(const __shared_ptr<_Tp1, _Lp>& __a,
-        const __shared_ptr<_Tp2, _Lp>& __b)
-    { return __a.get() < __b.get(); }
-
-  template<typename _Sp>
-    struct _Sp_less : public binary_function<_Sp, _Sp, bool>
-    {
-      bool
-      operator()(const _Sp& __lhs, const _Sp& __rhs) const
-      {
-        return std::less<typename _Sp::element_type*>()(__lhs.get(),
-            __rhs.get());
-      }
-    };
-
-  template<typename _Tp, _Lock_policy _Lp>
-    struct less<__shared_ptr<_Tp, _Lp>>
-    : public _Sp_less<__shared_ptr<_Tp, _Lp>>
-    { };
-
-  // XXX LessThanComparable<_Tp> concept should provide >, >= and <=
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator>(const __shared_ptr<_Tp, _Lp>& __a,
-        const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() > __b.get(); }
-
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator>=(const __shared_ptr<_Tp, _Lp>& __a,
-        const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() >= __b.get(); }
-
-  template<typename _Tp, _Lock_policy _Lp>
-    inline bool
-    operator<=(const __shared_ptr<_Tp, _Lp>& __a,
-        const __shared_ptr<_Tp, _Lp>& __b)
-    { return __a.get() <= __b.get(); }
-
-  // 2.2.3.8 shared_ptr specialized algorithms.
-  template<typename _Tp, _Lock_policy _Lp>
-    inline void
-    swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
-    { __a.swap(__b); }
-
-  // 2.2.3.9 shared_ptr casts
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
-   */
-  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
-    inline __shared_ptr<_Tp, _Lp>
-    static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
-    { return __shared_ptr<_Tp, _Lp>(__r, static_cast<_Tp*>(__r.get())); }
-
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
-   */
-  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
-    inline __shared_ptr<_Tp, _Lp>
-    const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
-    { return __shared_ptr<_Tp, _Lp>(__r, const_cast<_Tp*>(__r.get())); }
-
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
-   */
-  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
-    inline __shared_ptr<_Tp, _Lp>
-    dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
-    {
-      if (_Tp* __p = dynamic_cast<_Tp*>(__r.get()))
-        return __shared_ptr<_Tp, _Lp>(__r, __p);
-      return __shared_ptr<_Tp, _Lp>();
-    }
-
-  // 2.2.3.7 shared_ptr I/O
-  template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>
-    std::basic_ostream<_Ch, _Tr>&
-    operator<<(std::basic_ostream<_Ch, _Tr>& __os, 
-              const __shared_ptr<_Tp, _Lp>& __p)
-    {
-      __os << __p.get();
-      return __os;
-    }
-
-  // 2.2.3.10 shared_ptr get_deleter (experimental)
-  template<typename _Del, typename _Tp, _Lock_policy _Lp>
-    inline _Del*
-    get_deleter(const __shared_ptr<_Tp, _Lp>& __p)
-    { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); }
-
-
-  template<typename _Tp, _Lock_policy _Lp>
-    class __weak_ptr
-    {
-    public:
-      typedef _Tp element_type;
-      
-      __weak_ptr()
-      : _M_ptr(0), _M_refcount() // never throws
-      { }
-
-      // Generated copy constructor, assignment, destructor are fine.
-      
-      // The "obvious" converting constructor implementation:
-      //
-      //  template<typename _Tp1>
-      //    __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
-      //    : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
-      //    { }
-      //
-      // has a serious problem.
-      //
-      //  __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)
-      //  conversion may require access to *__r._M_ptr (virtual inheritance).
-      //
-      // It is not possible to avoid spurious access violations since
-      // in multithreaded programs __r._M_ptr may be invalidated at any point.
-      template<typename _Tp1>
-        __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
-       : _M_refcount(__r._M_refcount) // never throws
-        {
-         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
-         _M_ptr = __r.lock().get();
-       }
-
-      template<typename _Tp1>
-        __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
-       : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
-        { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
-
-      template<typename _Tp1>
-        __weak_ptr&
-        operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws
-        {
-         _M_ptr = __r.lock().get();
-         _M_refcount = __r._M_refcount;
-         return *this;
-       }
-      
-      template<typename _Tp1>
-        __weak_ptr&
-        operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
-        {
-         _M_ptr = __r._M_ptr;
-         _M_refcount = __r._M_refcount;
-         return *this;
-       }
-
-      __shared_ptr<_Tp, _Lp>
-      lock() const // never throws
-      {
-#ifdef __GTHREADS
-       // Optimization: avoid throw overhead.
-       if (expired())
-         return __shared_ptr<element_type, _Lp>();
-
-       __try
-         {
-           return __shared_ptr<element_type, _Lp>(*this);
-         }
-       __catch(const bad_weak_ptr&)
-         {
-           // Q: How can we get here?
-           // A: Another thread may have invalidated r after the
-           //    use_count test above.
-           return __shared_ptr<element_type, _Lp>();
-         }
-       
-#else
-       // Optimization: avoid try/catch overhead when single threaded.
-       return expired() ? __shared_ptr<element_type, _Lp>()
-                        : __shared_ptr<element_type, _Lp>(*this);
-
-#endif
-      } // XXX MT
-
-      long
-      use_count() const // never throws
-      { return _M_refcount._M_get_use_count(); }
-
-      bool
-      expired() const // never throws
-      { return _M_refcount._M_get_use_count() == 0; }
-
-      template<typename _Tp1>
-        bool
-        owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const
-        { return _M_refcount._M_less(__rhs._M_refcount); }
-
-      template<typename _Tp1>
-        bool
-        owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const
-        { return _M_refcount._M_less(__rhs._M_refcount); }
-
-      void
-      reset() // never throws
-      { __weak_ptr().swap(*this); }
-
-      void
-      swap(__weak_ptr& __s) // never throws
-      {
-       std::swap(_M_ptr, __s._M_ptr);
-       _M_refcount._M_swap(__s._M_refcount);
-      }
-
-      // comparisons
-      template<typename _Tp1>
-        bool operator<(const __weak_ptr<_Tp1, _Lp>&) const = delete;
-      template<typename _Tp1>
-        bool operator<=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
-      template<typename _Tp1>
-        bool operator>(const __weak_ptr<_Tp1, _Lp>&) const = delete;
-      template<typename _Tp1>
-        bool operator>=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
-
-    private:
-      // Used by __enable_shared_from_this.
-      void
-      _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)
-      {
-       _M_ptr = __ptr;
-       _M_refcount = __refcount;
-      }
-
-      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
-      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
-      friend class __enable_shared_from_this<_Tp, _Lp>;
-      friend class enable_shared_from_this<_Tp>;
-
-      _Tp*              _M_ptr;         // Contained pointer.
-      __weak_count<_Lp>  _M_refcount;    // Reference counter.
-    };
-
-  // 20.8.13.3.7 weak_ptr specialized algorithms.
-  template<typename _Tp, _Lock_policy _Lp>
-    inline void
-    swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)
-    { __a.swap(__b); }
-
-  /// owner_less
-  template<typename _Tp> struct owner_less;
-
-  template<typename _Tp, typename _Tp1>
-    struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool>
-    {
-      bool
-      operator()(const _Tp& __lhs, const _Tp& __rhs) const
-      { return __lhs.owner_before(__rhs); }
-      bool
-      operator()(const _Tp& __lhs, const _Tp1& __rhs) const
-      { return __lhs.owner_before(__rhs); }
-      bool
-      operator()(const _Tp1& __lhs, const _Tp& __rhs) const
-      { return __lhs.owner_before(__rhs); }
-    };
-
-  template<typename _Tp, _Lock_policy _Lp>
-    struct owner_less<__shared_ptr<_Tp, _Lp>>
-    : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>>
-    { };
-
-  template<typename _Tp, _Lock_policy _Lp>
-    struct owner_less<__weak_ptr<_Tp, _Lp>>
-    : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>>
-    {
-    };
-
-
-  template<typename _Tp, _Lock_policy _Lp>
-    class __enable_shared_from_this
-    {
-    protected:
-      __enable_shared_from_this() { }
-      
-      __enable_shared_from_this(const __enable_shared_from_this&) { }
-      
-      __enable_shared_from_this&
-      operator=(const __enable_shared_from_this&)
-      { return *this; }
-
-      ~__enable_shared_from_this() { }
-      
-    public:
-      __shared_ptr<_Tp, _Lp>
-      shared_from_this()
-      { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }
-
-      __shared_ptr<const _Tp, _Lp>
-      shared_from_this() const
-      { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }
-
-    private:
-      template<typename _Tp1>
-        void
-        _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const
-        { _M_weak_this._M_assign(__p, __n); }
-
-      template<typename _Tp1>
-        friend void
-        __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,
-                                        const __enable_shared_from_this* __pe,
-                                        const _Tp1* __px)
-        {
-         if (__pe != 0)
-           __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
-       }
-
-      mutable __weak_ptr<_Tp, _Lp>  _M_weak_this;
-    };
-
-  /**
-   *  @brief A smart pointer with reference-counted copy semantics. 
-   *  
-   *  The object pointed to is deleted when the last shared_ptr pointing to
-   *  it is destroyed or reset.
-   */
-  template<typename _Tp>
-    class shared_ptr
-    : public __shared_ptr<_Tp>
-    {
-    public:
-      shared_ptr()
-      : __shared_ptr<_Tp>() { }
-
-      template<typename _Tp1>
-        explicit
-        shared_ptr(_Tp1* __p)
-       : __shared_ptr<_Tp>(__p) { }
-
-      template<typename _Tp1, typename _Deleter>
-        shared_ptr(_Tp1* __p, _Deleter __d)
-       : __shared_ptr<_Tp>(__p, __d) { }
-
-      template<typename _Tp1, typename _Deleter, typename _Alloc>
-        shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
-       : __shared_ptr<_Tp>(__p, __d, __a) { }
-
-      // Aliasing constructor
-      template<typename _Tp1>
-        shared_ptr(const shared_ptr<_Tp1>& __r, _Tp* __p)
-       : __shared_ptr<_Tp>(__r, __p) { }
-
-      template<typename _Tp1>
-        shared_ptr(const shared_ptr<_Tp1>& __r)
-       : __shared_ptr<_Tp>(__r) { }
-
-      shared_ptr(shared_ptr&& __r)
-      : __shared_ptr<_Tp>(std::move(__r)) { }
-
-      template<typename _Tp1>
-        shared_ptr(shared_ptr<_Tp1>&& __r)
-        : __shared_ptr<_Tp>(std::move(__r)) { }
-
-      template<typename _Tp1>
-        explicit
-        shared_ptr(const weak_ptr<_Tp1>& __r)
+       explicit shared_ptr(const weak_ptr<_Tp1>& __r)
        : __shared_ptr<_Tp>(__r) { }
 
 #if _GLIBCXX_DEPRECATED
       template<typename _Tp1>
-        explicit
-        shared_ptr(std::auto_ptr<_Tp1>&& __r)
+       explicit
+       shared_ptr(std::auto_ptr<_Tp1>&& __r)
        : __shared_ptr<_Tp>(std::move(__r)) { }
 #endif
 
       template<typename _Tp1, typename _Del>
-        explicit
-        shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
+       explicit shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
 
       template<typename _Tp1, typename _Del>
-        explicit
-        shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
+       explicit shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
        : __shared_ptr<_Tp>(std::move(__r)) { }
 
       template<typename _Tp1>
-        shared_ptr&
-        operator=(const shared_ptr<_Tp1>& __r) // never throws
-        {
+       shared_ptr&
+       operator=(const shared_ptr<_Tp1>& __r) // never throws
+       {
          this->__shared_ptr<_Tp>::operator=(__r);
          return *this;
        }
 
 #if _GLIBCXX_DEPRECATED
       template<typename _Tp1>
-        shared_ptr&
-        operator=(std::auto_ptr<_Tp1>&& __r)
-        {
+       shared_ptr&
+       operator=(std::auto_ptr<_Tp1>&& __r)
+       {
          this->__shared_ptr<_Tp>::operator=(std::move(__r));
          return *this;
        }
@@ -1294,26 +235,26 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       shared_ptr&
       operator=(shared_ptr&& __r)
       {
-        this->__shared_ptr<_Tp>::operator=(std::move(__r));
-        return *this;
+       this->__shared_ptr<_Tp>::operator=(std::move(__r));
+       return *this;
       }
-     
+
       template<class _Tp1>
-        shared_ptr&
-        operator=(shared_ptr<_Tp1>&& __r)
-        {
-          this->__shared_ptr<_Tp>::operator=(std::move(__r));
-          return *this;
-        }
+       shared_ptr&
+       operator=(shared_ptr<_Tp1>&& __r)
+       {
+         this->__shared_ptr<_Tp>::operator=(std::move(__r));
+         return *this;
+       }
 
       template<typename _Tp1, typename _Del>
-        shared_ptr&
-        operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
+       shared_ptr&
+       operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
 
       template<typename _Tp1, typename _Del>
-        shared_ptr&
-        operator=(std::unique_ptr<_Tp1, _Del>&& __r)
-        {
+       shared_ptr&
+       operator=(std::unique_ptr<_Tp1, _Del>&& __r)
+       {
          this->__shared_ptr<_Tp>::operator=(std::move(__r));
          return *this;
        }
@@ -1321,13 +262,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     private:
       // This constructor is non-standard, it is used by allocate_shared.
       template<typename _Alloc, typename... _Args>
-        shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
-        : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...)
-        { }
+       shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+       : __shared_ptr<_Tp>(__tag, __a, std::forward<_Args>(__args)...)
+       { }
 
       template<typename _Tp1, typename _Alloc, typename... _Args>
-        friend shared_ptr<_Tp1>
-        allocate_shared(_Alloc __a, _Args&&... __args);
+       friend shared_ptr<_Tp1>
+       allocate_shared(_Alloc __a, _Args&&... __args);
     };
 
   // 20.8.13.2.7 shared_ptr comparisons
@@ -1347,8 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     { return __a.get() < __b.get(); }
 
   template<typename _Tp>
-    struct less<shared_ptr<_Tp>>
-    : public _Sp_less<shared_ptr<_Tp>>
+    struct less<shared_ptr<_Tp>> : public _Sp_less<shared_ptr<_Tp>>
     { };
 
   // 20.8.13.2.9 shared_ptr specialized algorithms.
@@ -1373,44 +313,42 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     dynamic_pointer_cast(const shared_ptr<_Tp1>& __r)
     {
       if (_Tp* __p = dynamic_cast<_Tp*>(__r.get()))
-        return shared_ptr<_Tp>(__r, __p);
+       return shared_ptr<_Tp>(__r, __p);
       return shared_ptr<_Tp>();
     }
 
 
-  /** 
-   *  @brief A smart pointer with weak semantics.
-   *  
+  /**
+   *  @brief  A smart pointer with weak semantics.
+   *
    *  With forwarding constructors and assignment operators.
    */
   template<typename _Tp>
-    class weak_ptr
-    : public __weak_ptr<_Tp>
+    class weak_ptr : public __weak_ptr<_Tp>
     {
     public:
-      weak_ptr()
-      : __weak_ptr<_Tp>() { }
-      
+      weak_ptr() : __weak_ptr<_Tp>() { }
+
       template<typename _Tp1>
-        weak_ptr(const weak_ptr<_Tp1>& __r)
+       weak_ptr(const weak_ptr<_Tp1>& __r)
        : __weak_ptr<_Tp>(__r) { }
 
       template<typename _Tp1>
-        weak_ptr(const shared_ptr<_Tp1>& __r)
+       weak_ptr(const shared_ptr<_Tp1>& __r)
        : __weak_ptr<_Tp>(__r) { }
 
       template<typename _Tp1>
-        weak_ptr&
-        operator=(const weak_ptr<_Tp1>& __r) // never throws
-        {
+       weak_ptr&
+       operator=(const weak_ptr<_Tp1>& __r) // never throws
+       {
          this->__weak_ptr<_Tp>::operator=(__r);
          return *this;
        }
 
       template<typename _Tp1>
-        weak_ptr&
-        operator=(const shared_ptr<_Tp1>& __r) // never throws
-        {
+       weak_ptr&
+       operator=(const shared_ptr<_Tp1>& __r) // never throws
+       {
          this->__weak_ptr<_Tp>::operator=(__r);
          return *this;
        }
@@ -1431,20 +369,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
            return shared_ptr<_Tp>();
          }
 #else
-       return this->expired() ? shared_ptr<_Tp>()
-                              : shared_ptr<_Tp>(*this);
+       return this->expired() ? shared_ptr<_Tp>() : shared_ptr<_Tp>(*this);
 #endif
       }
 
-      // comparisons
+      // Comparisons
       template<typename _Tp1>
-        bool operator<(const weak_ptr<_Tp1>&) const = delete;
+       bool operator<(const weak_ptr<_Tp1>&) const = delete;
       template<typename _Tp1>
-        bool operator<=(const weak_ptr<_Tp1>&) const = delete;
+       bool operator<=(const weak_ptr<_Tp1>&) const = delete;
       template<typename _Tp1>
-        bool operator>(const weak_ptr<_Tp1>&) const = delete;
+       bool operator>(const weak_ptr<_Tp1>&) const = delete;
       template<typename _Tp1>
-        bool operator>=(const weak_ptr<_Tp1>&) const = delete;
+       bool operator>=(const weak_ptr<_Tp1>&) const = delete;
     };
 
   // 20.8.13.3.7 weak_ptr specialized algorithms.
@@ -1453,18 +390,24 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b)
     { __a.swap(__b); }
 
-  /// owner_less
+
+  /// Primary template owner_less
+  template<typename _Tp>
+    struct owner_less;
+
+  /// Partial specialization of owner_less for shared_ptr.
   template<typename _Tp>
     struct owner_less<shared_ptr<_Tp>>
     : public _Sp_owner_less<shared_ptr<_Tp>, weak_ptr<_Tp>>
     { };
 
+  /// Partial specialization of owner_less for weak_ptr.
   template<typename _Tp>
     struct owner_less<weak_ptr<_Tp>>
     : public _Sp_owner_less<weak_ptr<_Tp>, shared_ptr<_Tp>>
     { };
 
-  /** 
+  /**
    *  @brief Base class allowing use of member function shared_from_this.
    */
   template<typename _Tp>
@@ -1472,7 +415,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     {
     protected:
       enable_shared_from_this() { }
-      
+
       enable_shared_from_this(const enable_shared_from_this&) { }
 
       enable_shared_from_this&
@@ -1492,16 +435,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
     private:
       template<typename _Tp1>
-        void
-        _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const
-        { _M_weak_this._M_assign(__p, __n); }
+       void
+       _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const
+       { _M_weak_this._M_assign(__p, __n); }
 
       template<typename _Tp1>
-        friend void
-        __enable_shared_from_this_helper(const __shared_count<>& __pn,
+       friend void
+       __enable_shared_from_this_helper(const __shared_count<>& __pn,
                                         const enable_shared_from_this* __pe,
                                         const _Tp1* __px)
-        {
+       {
          if (__pe != 0)
            __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
        }
@@ -1509,24 +452,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       mutable weak_ptr<_Tp>  _M_weak_this;
     };
 
-  template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args>
-    inline __shared_ptr<_Tp, _Lp>
-    __allocate_shared(_Alloc __a, _Args&&... __args)
-    {
-      return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(),
-          std::forward<_Alloc>(__a), std::forward<_Args>(__args)...);
-    }
-
-  template<typename _Tp, _Lock_policy _Lp, typename... _Args>
-    inline __shared_ptr<_Tp, _Lp>
-    __make_shared(_Args&&... __args)
-    {
-      typedef typename std::remove_const<_Tp>::type _Tp_nc;
-      return __allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(),
-              std::forward<_Args>(__args)...);
-    }
-
-  /** @brief  Create an object that is owned by a shared_ptr.
+  /**
+   *  @brief  Create an object that is owned by a shared_ptr.
    *  @param  __a     An allocator.
    *  @param  __args  Arguments for the @a _Tp object's constructor.
    *  @return A shared_ptr that owns the newly created object.
@@ -1541,10 +468,11 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     allocate_shared(_Alloc __a, _Args&&... __args)
     {
       return shared_ptr<_Tp>(_Sp_make_shared_tag(), std::forward<_Alloc>(__a),
-              std::forward<_Args>(__args)...);
+                            std::forward<_Args>(__args)...);
     }
 
-  /** @brief  Create an object that is owned by a shared_ptr. 
+  /**
+   *  @brief  Create an object that is owned by a shared_ptr.
    *  @param  __args  Arguments for the @a _Tp object's constructor.
    *  @return A shared_ptr that owns the newly created object.
    *  @throw  std::bad_alloc, or an exception thrown from the
@@ -1556,7 +484,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     {
       typedef typename std::remove_const<_Tp>::type _Tp_nc;
       return allocate_shared<_Tp>(std::allocator<_Tp_nc>(),
-              std::forward<_Args>(__args)...);
+                                 std::forward<_Args>(__args)...);
     }
 
   // @} group pointer_abstractions
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
new file mode 100644 (file)
index 0000000..b8083e4
--- /dev/null
@@ -0,0 +1,1114 @@
+// shared_ptr and weak_ptr implementation details -*- C++ -*-
+
+// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// <http://www.gnu.org/licenses/>.
+
+// GCC Note: Based on files from version 1.32.0 of the Boost library.
+
+//  shared_count.hpp
+//  Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
+
+//  shared_ptr.hpp
+//  Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.
+//  Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+//  weak_ptr.hpp
+//  Copyright (C) 2001, 2002, 2003 Peter Dimov
+
+//  enable_shared_from_this.hpp
+//  Copyright (C) 2002 Peter Dimov
+
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+/** @file bits/shared_ptr_base.h
+ *  This is an internal header file, included by other library headers.
+ *  You should not attempt to use it directly.
+ */
+
+#ifndef _SHARED_PTR_BASE_H
+#define _SHARED_PTR_BASE_H 1
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  // Forward declarations.
+  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+    class __shared_ptr;
+
+  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+    class __weak_ptr;
+
+  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>
+    class __enable_shared_from_this;
+
+  template<typename _Tp>
+    class shared_ptr;
+
+  template<typename _Tp>
+    class weak_ptr;
+
+  template<typename _Tp>
+    struct owner_less;
+
+  template<typename _Tp>
+    class enable_shared_from_this;
+
+  template<_Lock_policy _Lp = __default_lock_policy>
+    class __weak_count;
+
+  template<_Lock_policy _Lp = __default_lock_policy>
+    class __shared_count;
+
+
+  // Counted ptr with no deleter or allocator support
+  template<typename _Ptr, _Lock_policy _Lp>
+    class _Sp_counted_ptr : public _Sp_counted_base<_Lp>
+    {
+    public:
+      _Sp_counted_ptr(_Ptr __p)
+      : _M_ptr(__p) { }
+
+      virtual void
+      _M_dispose() // nothrow
+      { delete _M_ptr; }
+
+      virtual void
+      _M_destroy() // nothrow
+      { delete this; }
+
+      virtual void*
+      _M_get_deleter(const std::type_info& __ti)
+      { return 0; }
+
+      _Sp_counted_ptr(const _Sp_counted_ptr&) = delete;
+      _Sp_counted_ptr& operator=(const _Sp_counted_ptr&) = delete;
+
+    protected:
+      _Ptr             _M_ptr;  // copy constructor must not throw
+    };
+
+  // Support for custom deleter and/or allocator
+  template<typename _Ptr, typename _Deleter, typename _Alloc, _Lock_policy _Lp>
+    class _Sp_counted_deleter : public _Sp_counted_ptr<_Ptr, _Lp>
+    {
+      typedef typename _Alloc::template
+         rebind<_Sp_counted_deleter>::other _My_alloc_type;
+
+      // Helper class that stores the Deleter and also acts as an allocator.
+      // Used to dispose of the owned pointer and the internal refcount
+      // Requires that copies of _Alloc can free each other's memory.
+      struct _My_Deleter
+      : public _My_alloc_type    // copy constructor must not throw
+      {
+       _Deleter _M_del;         // copy constructor must not throw
+       _My_Deleter(_Deleter __d, const _Alloc& __a)
+         : _My_alloc_type(__a), _M_del(__d) { }
+      };
+
+    protected:
+      typedef _Sp_counted_ptr<_Ptr, _Lp> _Base_type;
+
+    public:
+      // __d(__p) must not throw.
+      _Sp_counted_deleter(_Ptr __p, _Deleter __d)
+      : _Base_type(__p), _M_del(__d, _Alloc()) { }
+
+      // __d(__p) must not throw.
+      _Sp_counted_deleter(_Ptr __p, _Deleter __d, const _Alloc& __a)
+      : _Base_type(__p), _M_del(__d, __a) { }
+
+      virtual void
+      _M_dispose() // nothrow
+      { _M_del._M_del(_Base_type::_M_ptr); }
+
+      virtual void
+      _M_destroy() // nothrow
+      {
+       _My_alloc_type __a(_M_del);
+       this->~_Sp_counted_deleter();
+       __a.deallocate(this, 1);
+      }
+
+      virtual void*
+      _M_get_deleter(const std::type_info& __ti)
+      { return __ti == typeid(_Deleter) ? &_M_del._M_del : 0; }
+
+    protected:
+      _My_Deleter      _M_del;  // copy constructor must not throw
+    };
+
+  // helpers for make_shared / allocate_shared
+
+  template<typename _Tp>
+    struct _Sp_destroy_inplace
+    {
+      void operator()(_Tp* __p) const { if (__p) __p->~_Tp(); }
+    };
+
+  struct _Sp_make_shared_tag { };
+
+  template<typename _Tp, typename _Alloc, _Lock_policy _Lp>
+    class _Sp_counted_ptr_inplace
+    : public _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
+    {
+      typedef _Sp_counted_deleter<_Tp*, _Sp_destroy_inplace<_Tp>, _Alloc, _Lp>
+       _Base_type;
+
+    public:
+      _Sp_counted_ptr_inplace(_Alloc __a)
+      : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
+      , _M_storage()
+      {
+       void* __p = &_M_storage;
+       ::new (__p) _Tp();  // might throw
+       _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
+      }
+
+      template<typename... _Args>
+       _Sp_counted_ptr_inplace(_Alloc __a, _Args&&... __args)
+       : _Base_type(static_cast<_Tp*>(0), _Sp_destroy_inplace<_Tp>(), __a)
+       , _M_storage()
+       {
+         void* __p = &_M_storage;
+         ::new (__p) _Tp(std::forward<_Args>(__args)...);  // might throw
+         _Base_type::_Base_type::_M_ptr = static_cast<_Tp*>(__p);
+       }
+
+      // Override because the allocator needs to know the dynamic type
+      virtual void
+      _M_destroy() // nothrow
+      {
+       typedef typename _Alloc::template
+           rebind<_Sp_counted_ptr_inplace>::other _My_alloc_type;
+       _My_alloc_type __a(_Base_type::_M_del);
+       this->~_Sp_counted_ptr_inplace();
+       __a.deallocate(this, 1);
+      }
+
+      // Sneaky trick so __shared_ptr can get the managed pointer
+      virtual void*
+      _M_get_deleter(const std::type_info& __ti)
+      {
+       return __ti == typeid(_Sp_make_shared_tag)
+              ? static_cast<void*>(&_M_storage)
+              : _Base_type::_M_get_deleter(__ti);
+      }
+
+    private:
+      typename aligned_storage<sizeof(_Tp), alignment_of<_Tp>::value>::type
+       _M_storage;
+    };
+
+  template<_Lock_policy _Lp>
+    class __shared_count
+    {
+    public:
+      __shared_count() : _M_pi(0) // nothrow
+      { }
+
+      template<typename _Ptr>
+       __shared_count(_Ptr __p) : _M_pi(0)
+       {
+         __try
+           {
+             _M_pi = new _Sp_counted_ptr<_Ptr, _Lp>(__p);
+           }
+         __catch(...)
+           {
+             delete __p;
+             __throw_exception_again;
+           }
+       }
+
+      template<typename _Ptr, typename _Deleter>
+       __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)
+       {
+         // The allocator's value_type doesn't matter, will rebind it anyway.
+         typedef std::allocator<int> _Alloc;
+         typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
+         typedef std::allocator<_Sp_cd_type> _Alloc2;
+         _Alloc2 __a2;
+         __try
+           {
+             _M_pi = __a2.allocate(1);
+             ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d);
+           }
+         __catch(...)
+           {
+             __d(__p); // Call _Deleter on __p.
+             if (_M_pi)
+               __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
+             __throw_exception_again;
+           }
+       }
+
+      template<typename _Ptr, typename _Deleter, typename _Alloc>
+       __shared_count(_Ptr __p, _Deleter __d, _Alloc __a) : _M_pi(0)
+       {
+         typedef _Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp> _Sp_cd_type;
+         typedef typename _Alloc::template rebind<_Sp_cd_type>::other _Alloc2;
+         _Alloc2 __a2(__a);
+         __try
+           {
+             _M_pi = __a2.allocate(1);
+             ::new(static_cast<void*>(_M_pi)) _Sp_cd_type(__p, __d, __a);
+           }
+         __catch(...)
+           {
+             __d(__p); // Call _Deleter on __p.
+             if (_M_pi)
+               __a2.deallocate(static_cast<_Sp_cd_type*>(_M_pi), 1);
+             __throw_exception_again;
+           }
+       }
+
+      template<typename _Tp, typename _Alloc, typename... _Args>
+       __shared_count(_Sp_make_shared_tag, _Tp*, _Alloc __a, _Args&&... __args)
+       : _M_pi(0)
+       {
+         typedef _Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp> _Sp_cp_type;
+         typedef typename _Alloc::template rebind<_Sp_cp_type>::other _Alloc2;
+         _Alloc2 __a2(__a);
+         __try
+           {
+             _M_pi = __a2.allocate(1);
+             ::new(static_cast<void*>(_M_pi)) _Sp_cp_type(__a,
+                   std::forward<_Args>(__args)...);
+           }
+         __catch(...)
+           {
+             if (_M_pi)
+               __a2.deallocate(static_cast<_Sp_cp_type*>(_M_pi), 1);
+             __throw_exception_again;
+           }
+       }
+
+#if _GLIBCXX_DEPRECATED
+      // Special case for auto_ptr<_Tp> to provide the strong guarantee.
+      template<typename _Tp>
+       explicit __shared_count(std::auto_ptr<_Tp>&& __r)
+       : _M_pi(new _Sp_counted_ptr<_Tp*, _Lp>(__r.get()))
+       { __r.release(); }
+#endif
+
+      // Special case for unique_ptr<_Tp,_Del> to provide the strong guarantee.
+      template<typename _Tp, typename _Del>
+       explicit __shared_count(std::unique_ptr<_Tp, _Del>&& __r)
+       : _M_pi(_S_create_from_up(std::move(__r)))
+       { __r.release(); }
+
+      // Throw bad_weak_ptr when __r._M_get_use_count() == 0.
+      explicit __shared_count(const __weak_count<_Lp>& __r);
+
+      ~__shared_count() // nothrow
+      {
+       if (_M_pi != 0)
+         _M_pi->_M_release();
+      }
+
+      __shared_count(const __shared_count& __r)
+      : _M_pi(__r._M_pi) // nothrow
+      {
+       if (_M_pi != 0)
+         _M_pi->_M_add_ref_copy();
+      }
+
+      __shared_count&
+      operator=(const __shared_count& __r) // nothrow
+      {
+       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+       if (__tmp != _M_pi)
+         {
+           if (__tmp != 0)
+             __tmp->_M_add_ref_copy();
+           if (_M_pi != 0)
+             _M_pi->_M_release();
+           _M_pi = __tmp;
+         }
+       return *this;
+      }
+
+      void
+      _M_swap(__shared_count& __r) // nothrow
+      {
+       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+       __r._M_pi = _M_pi;
+       _M_pi = __tmp;
+      }
+
+      long
+      _M_get_use_count() const // nothrow
+      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+      bool
+      _M_unique() const // nothrow
+      { return this->_M_get_use_count() == 1; }
+
+      void*
+      _M_get_deleter(const std::type_info& __ti) const
+      { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }
+
+      bool
+      _M_less(const __shared_count& __rhs) const
+      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+      bool
+      _M_less(const __weak_count<_Lp>& __rhs) const
+      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+      // Friend function injected into enclosing namespace and found by ADL
+      friend inline bool
+      operator==(const __shared_count& __a, const __shared_count& __b)
+      { return __a._M_pi == __b._M_pi; }
+
+    private:
+      friend class __weak_count<_Lp>;
+
+      template<typename _Tp, typename _Del>
+       static _Sp_counted_base<_Lp>*
+       _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
+         typename std::enable_if<!std::is_reference<_Del>::value>::type* = 0)
+       {
+         return new _Sp_counted_deleter<_Tp*, _Del, std::allocator<_Tp>,
+           _Lp>(__r.get(), __r.get_deleter());
+       }
+
+      template<typename _Tp, typename _Del>
+       static _Sp_counted_base<_Lp>*
+       _S_create_from_up(std::unique_ptr<_Tp, _Del>&& __r,
+         typename std::enable_if<std::is_reference<_Del>::value>::type* = 0)
+       {
+         typedef typename std::remove_reference<_Del>::type _Del1;
+         typedef std::reference_wrapper<_Del1> _Del2;
+         return new _Sp_counted_deleter<_Tp*, _Del2, std::allocator<_Tp>,
+           _Lp>(__r.get(), std::ref(__r.get_deleter()));
+       }
+
+      _Sp_counted_base<_Lp>*  _M_pi;
+    };
+
+
+  template<_Lock_policy _Lp>
+    class __weak_count
+    {
+    public:
+      __weak_count() : _M_pi(0) // nothrow
+      { }
+
+      __weak_count(const __shared_count<_Lp>& __r) : _M_pi(__r._M_pi) // nothrow
+      {
+       if (_M_pi != 0)
+         _M_pi->_M_weak_add_ref();
+      }
+
+      __weak_count(const __weak_count<_Lp>& __r) : _M_pi(__r._M_pi) // nothrow
+      {
+       if (_M_pi != 0)
+         _M_pi->_M_weak_add_ref();
+      }
+
+      ~__weak_count() // nothrow
+      {
+       if (_M_pi != 0)
+         _M_pi->_M_weak_release();
+      }
+
+      __weak_count<_Lp>&
+      operator=(const __shared_count<_Lp>& __r) // nothrow
+      {
+       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+       if (__tmp != 0)
+         __tmp->_M_weak_add_ref();
+       if (_M_pi != 0)
+         _M_pi->_M_weak_release();
+       _M_pi = __tmp;
+       return *this;
+      }
+
+      __weak_count<_Lp>&
+      operator=(const __weak_count<_Lp>& __r) // nothrow
+      {
+       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+       if (__tmp != 0)
+         __tmp->_M_weak_add_ref();
+       if (_M_pi != 0)
+         _M_pi->_M_weak_release();
+       _M_pi = __tmp;
+       return *this;
+      }
+
+      void
+      _M_swap(__weak_count<_Lp>& __r) // nothrow
+      {
+       _Sp_counted_base<_Lp>* __tmp = __r._M_pi;
+       __r._M_pi = _M_pi;
+       _M_pi = __tmp;
+      }
+
+      long
+      _M_get_use_count() const // nothrow
+      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }
+
+      bool
+      _M_less(const __weak_count& __rhs) const
+      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+      bool
+      _M_less(const __shared_count<_Lp>& __rhs) const
+      { return std::less<_Sp_counted_base<_Lp>*>()(this->_M_pi, __rhs._M_pi); }
+
+      // Friend function injected into enclosing namespace and found by ADL
+      friend inline bool
+      operator==(const __weak_count& __a, const __weak_count& __b)
+      { return __a._M_pi == __b._M_pi; }
+
+    private:
+      friend class __shared_count<_Lp>;
+
+      _Sp_counted_base<_Lp>*  _M_pi;
+    };
+
+  // Now that __weak_count is defined we can define this constructor:
+  template<_Lock_policy _Lp>
+    inline __shared_count<_Lp>:: __shared_count(const __weak_count<_Lp>& __r)
+    : _M_pi(__r._M_pi)
+    {
+      if (_M_pi != 0)
+       _M_pi->_M_add_ref_lock();
+      else
+       __throw_bad_weak_ptr();
+    }
+
+
+  // Support for enable_shared_from_this.
+
+  // Friend of __enable_shared_from_this.
+  template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>
+    void
+    __enable_shared_from_this_helper(const __shared_count<_Lp>&,
+                                    const __enable_shared_from_this<_Tp1,
+                                    _Lp>*, const _Tp2*);
+
+  // Friend of enable_shared_from_this.
+  template<typename _Tp1, typename _Tp2>
+    void
+    __enable_shared_from_this_helper(const __shared_count<>&,
+                                    const enable_shared_from_this<_Tp1>*,
+                                    const _Tp2*);
+
+  template<_Lock_policy _Lp>
+    inline void
+    __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)
+    { }
+
+
+  template<typename _Tp, _Lock_policy _Lp>
+    class __shared_ptr
+    {
+    public:
+      typedef _Tp   element_type;
+
+      __shared_ptr() : _M_ptr(0), _M_refcount() // never throws
+      { }
+
+      template<typename _Tp1>
+       explicit __shared_ptr(_Tp1* __p) : _M_ptr(__p), _M_refcount(__p)
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         // __glibcxx_function_requires(_CompleteConcept<_Tp1*>)
+         __enable_shared_from_this_helper(_M_refcount, __p, __p);
+       }
+
+      template<typename _Tp1, typename _Deleter>
+       __shared_ptr(_Tp1* __p, _Deleter __d)
+       : _M_ptr(__p), _M_refcount(__p, __d)
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
+         __enable_shared_from_this_helper(_M_refcount, __p, __p);
+       }
+
+      template<typename _Tp1, typename _Deleter, typename _Alloc>
+       __shared_ptr(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+       : _M_ptr(__p), _M_refcount(__p, __d, __a)
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         // TODO requires _Deleter CopyConstructible and __d(__p) well-formed
+         __enable_shared_from_this_helper(_M_refcount, __p, __p);
+       }
+
+      template<typename _Tp1>
+       __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, _Tp* __p)
+       : _M_ptr(__p), _M_refcount(__r._M_refcount) // never throws
+       { }
+
+      //  generated copy constructor, assignment, destructor are fine.
+
+      template<typename _Tp1>
+       __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+       : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+       { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+      __shared_ptr(__shared_ptr&& __r)
+      : _M_ptr(__r._M_ptr), _M_refcount() // never throws
+      {
+       _M_refcount._M_swap(__r._M_refcount);
+       __r._M_ptr = 0;
+      }
+
+      template<typename _Tp1>
+       __shared_ptr(__shared_ptr<_Tp1, _Lp>&& __r)
+       : _M_ptr(__r._M_ptr), _M_refcount() // never throws
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         _M_refcount._M_swap(__r._M_refcount);
+         __r._M_ptr = 0;
+       }
+
+      template<typename _Tp1>
+       explicit __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+       : _M_refcount(__r._M_refcount) // may throw
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+
+         // It is now safe to copy __r._M_ptr, as
+         // _M_refcount(__r._M_refcount) did not throw.
+         _M_ptr = __r._M_ptr;
+       }
+
+      template<typename _Tp1, typename _Del>
+       explicit __shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete;
+
+      // If an exception is thrown this constructor has no effect.
+      template<typename _Tp1, typename _Del>
+       explicit __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r)
+       : _M_ptr(__r.get()), _M_refcount()
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         _Tp1* __tmp = __r.get();
+         _M_refcount = __shared_count<_Lp>(std::move(__r));
+         __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+       }
+
+#if _GLIBCXX_DEPRECATED
+      // Postcondition: use_count() == 1 and __r.get() == 0
+      template<typename _Tp1>
+       explicit __shared_ptr(std::auto_ptr<_Tp1>&& __r)
+       : _M_ptr(__r.get()), _M_refcount()
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         // TODO requires _Tp1 is complete, delete __r.release() well-formed
+         _Tp1* __tmp = __r.get();
+         _M_refcount = __shared_count<_Lp>(std::move(__r));
+         __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
+       }
+#endif
+
+      template<typename _Tp1>
+       __shared_ptr&
+       operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+       {
+         _M_ptr = __r._M_ptr;
+         _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw
+         return *this;
+       }
+
+#if _GLIBCXX_DEPRECATED
+      template<typename _Tp1>
+       __shared_ptr&
+       operator=(std::auto_ptr<_Tp1>&& __r)
+       {
+         __shared_ptr(std::move(__r)).swap(*this);
+         return *this;
+       }
+#endif
+
+      __shared_ptr&
+      operator=(__shared_ptr&& __r)
+      {
+       __shared_ptr(std::move(__r)).swap(*this);
+       return *this;
+      }
+
+      template<class _Tp1>
+       __shared_ptr&
+       operator=(__shared_ptr<_Tp1, _Lp>&& __r)
+       {
+         __shared_ptr(std::move(__r)).swap(*this);
+         return *this;
+       }
+
+      template<typename _Tp1, typename _Del>
+       __shared_ptr&
+       operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete;
+
+      template<typename _Tp1, typename _Del>
+       __shared_ptr&
+       operator=(std::unique_ptr<_Tp1, _Del>&& __r)
+       {
+         __shared_ptr(std::move(__r)).swap(*this);
+         return *this;
+       }
+
+      void
+      reset() // never throws
+      { __shared_ptr().swap(*this); }
+
+      template<typename _Tp1>
+       void
+       reset(_Tp1* __p) // _Tp1 must be complete.
+       {
+         // Catch self-reset errors.
+         _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr);
+         __shared_ptr(__p).swap(*this);
+       }
+
+      template<typename _Tp1, typename _Deleter>
+       void
+       reset(_Tp1* __p, _Deleter __d)
+       { __shared_ptr(__p, __d).swap(*this); }
+
+      template<typename _Tp1, typename _Deleter, typename _Alloc>
+       void
+       reset(_Tp1* __p, _Deleter __d, const _Alloc& __a)
+       { __shared_ptr(__p, __d, __a).swap(*this); }
+
+      // Allow class instantiation when _Tp is [cv-qual] void.
+      typename std::add_lvalue_reference<_Tp>::type
+      operator*() const // never throws
+      {
+       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+       return *_M_ptr;
+      }
+
+      _Tp*
+      operator->() const // never throws
+      {
+       _GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);
+       return _M_ptr;
+      }
+
+      _Tp*
+      get() const // never throws
+      { return _M_ptr; }
+
+      explicit operator bool() const // never throws
+      { return _M_ptr == 0 ? false : true; }
+
+      bool
+      unique() const // never throws
+      { return _M_refcount._M_unique(); }
+
+      long
+      use_count() const // never throws
+      { return _M_refcount._M_get_use_count(); }
+
+      void
+      swap(__shared_ptr<_Tp, _Lp>& __other) // never throws
+      {
+       std::swap(_M_ptr, __other._M_ptr);
+       _M_refcount._M_swap(__other._M_refcount);
+      }
+
+      template<typename _Tp1>
+       bool
+       owner_before(__shared_ptr<_Tp1, _Lp> const& __rhs) const
+       { return _M_refcount._M_less(__rhs._M_refcount); }
+
+      template<typename _Tp1>
+       bool
+       owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const
+       { return _M_refcount._M_less(__rhs._M_refcount); }
+
+    protected:
+      // This constructor is non-standard, it is used by allocate_shared.
+      template<typename _Alloc, typename... _Args>
+       __shared_ptr(_Sp_make_shared_tag __tag, _Alloc __a, _Args&&... __args)
+       : _M_ptr(), _M_refcount(__tag, (_Tp*)0, __a,
+                               std::forward<_Args>(__args)...)
+       {
+         // _M_ptr needs to point to the newly constructed object.
+         // This relies on _Sp_counted_ptr_inplace::_M_get_deleter.
+         void* __p = _M_refcount._M_get_deleter(typeid(__tag));
+         _M_ptr = static_cast<_Tp*>(__p);
+         __enable_shared_from_this_helper(_M_refcount, _M_ptr, _M_ptr);
+       }
+
+      template<typename _Tp1, _Lock_policy _Lp1, typename _Alloc,
+              typename... _Args>
+       friend __shared_ptr<_Tp1, _Lp1>
+       __allocate_shared(_Alloc __a, _Args&&... __args);
+
+    private:
+      void*
+      _M_get_deleter(const std::type_info& __ti) const
+      { return _M_refcount._M_get_deleter(__ti); }
+
+      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+
+      template<typename _Del, typename _Tp1, _Lock_policy _Lp1>
+       friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);
+
+      _Tp*                _M_ptr;         // Contained pointer.
+      __shared_count<_Lp>  _M_refcount;    // Reference counter.
+    };
+
+
+  // 20.8.13.2.7 shared_ptr comparisons
+  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+    inline bool
+    operator==(const __shared_ptr<_Tp1, _Lp>& __a,
+              const __shared_ptr<_Tp2, _Lp>& __b)
+    { return __a.get() == __b.get(); }
+
+  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+    inline bool
+    operator!=(const __shared_ptr<_Tp1, _Lp>& __a,
+              const __shared_ptr<_Tp2, _Lp>& __b)
+    { return __a.get() != __b.get(); }
+
+  template<typename _Tp1, typename _Tp2, _Lock_policy _Lp>
+    inline bool
+    operator<(const __shared_ptr<_Tp1, _Lp>& __a,
+             const __shared_ptr<_Tp2, _Lp>& __b)
+    { return __a.get() < __b.get(); }
+
+  template<typename _Sp>
+    struct _Sp_less : public binary_function<_Sp, _Sp, bool>
+    {
+      bool
+      operator()(const _Sp& __lhs, const _Sp& __rhs) const
+      {
+       typedef typename _Sp::element_type element_type;
+       return std::less<element_type*>()(__lhs.get(), __rhs.get());
+      }
+    };
+
+  template<typename _Tp, _Lock_policy _Lp>
+    struct less<__shared_ptr<_Tp, _Lp>>
+    : public _Sp_less<__shared_ptr<_Tp, _Lp>>
+    { };
+
+  // XXX LessThanComparable<_Tp> concept should provide >, >= and <=
+  template<typename _Tp, _Lock_policy _Lp>
+    inline bool
+    operator>(const __shared_ptr<_Tp, _Lp>& __a,
+             const __shared_ptr<_Tp, _Lp>& __b)
+    { return __a.get() > __b.get(); }
+
+  template<typename _Tp, _Lock_policy _Lp>
+    inline bool
+    operator>=(const __shared_ptr<_Tp, _Lp>& __a,
+              const __shared_ptr<_Tp, _Lp>& __b)
+    { return __a.get() >= __b.get(); }
+
+  template<typename _Tp, _Lock_policy _Lp>
+    inline bool
+    operator<=(const __shared_ptr<_Tp, _Lp>& __a,
+              const __shared_ptr<_Tp, _Lp>& __b)
+    { return __a.get() <= __b.get(); }
+
+  // 2.2.3.8 shared_ptr specialized algorithms.
+  template<typename _Tp, _Lock_policy _Lp>
+    inline void
+    swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)
+    { __a.swap(__b); }
+
+  // 2.2.3.9 shared_ptr casts
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// static_pointer_cast
+  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+    inline __shared_ptr<_Tp, _Lp>
+    static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+    { return __shared_ptr<_Tp, _Lp>(__r, static_cast<_Tp*>(__r.get())); }
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// const_pointer_cast
+  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+    inline __shared_ptr<_Tp, _Lp>
+    const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+    { return __shared_ptr<_Tp, _Lp>(__r, const_cast<_Tp*>(__r.get())); }
+
+  // The seemingly equivalent code:
+  // shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))
+  // will eventually result in undefined behaviour, attempting to
+  // delete the same object twice.
+  /// dynamic_pointer_cast
+  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
+    inline __shared_ptr<_Tp, _Lp>
+    dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
+    {
+      if (_Tp* __p = dynamic_cast<_Tp*>(__r.get()))
+       return __shared_ptr<_Tp, _Lp>(__r, __p);
+      return __shared_ptr<_Tp, _Lp>();
+    }
+
+
+  template<typename _Tp, _Lock_policy _Lp>
+    class __weak_ptr
+    {
+    public:
+      typedef _Tp element_type;
+
+      __weak_ptr() : _M_ptr(0), _M_refcount() // never throws
+      { }
+
+      // Generated copy constructor, assignment, destructor are fine.
+
+      // The "obvious" converting constructor implementation:
+      //
+      //  template<typename _Tp1>
+      //    __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+      //    : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+      //    { }
+      //
+      // has a serious problem.
+      //
+      //  __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)
+      //  conversion may require access to *__r._M_ptr (virtual inheritance).
+      //
+      // It is not possible to avoid spurious access violations since
+      // in multithreaded programs __r._M_ptr may be invalidated at any point.
+      template<typename _Tp1>
+       __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
+       : _M_refcount(__r._M_refcount) // never throws
+       {
+         __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)
+         _M_ptr = __r.lock().get();
+       }
+
+      template<typename _Tp1>
+       __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
+       : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
+       { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
+
+      template<typename _Tp1>
+       __weak_ptr&
+       operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws
+       {
+         _M_ptr = __r.lock().get();
+         _M_refcount = __r._M_refcount;
+         return *this;
+       }
+
+      template<typename _Tp1>
+       __weak_ptr&
+       operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws
+       {
+         _M_ptr = __r._M_ptr;
+         _M_refcount = __r._M_refcount;
+         return *this;
+       }
+
+      __shared_ptr<_Tp, _Lp>
+      lock() const // never throws
+      {
+#ifdef __GTHREADS
+       // Optimization: avoid throw overhead.
+       if (expired())
+         return __shared_ptr<element_type, _Lp>();
+
+       __try
+         {
+           return __shared_ptr<element_type, _Lp>(*this);
+         }
+       __catch(const bad_weak_ptr&)
+         {
+           // Q: How can we get here?
+           // A: Another thread may have invalidated r after the
+           //    use_count test above.
+           return __shared_ptr<element_type, _Lp>();
+         }
+
+#else
+       // Optimization: avoid try/catch overhead when single threaded.
+       return expired() ? __shared_ptr<element_type, _Lp>()
+                        : __shared_ptr<element_type, _Lp>(*this);
+
+#endif
+      } // XXX MT
+
+      long
+      use_count() const // never throws
+      { return _M_refcount._M_get_use_count(); }
+
+      bool
+      expired() const // never throws
+      { return _M_refcount._M_get_use_count() == 0; }
+
+      template<typename _Tp1>
+       bool
+       owner_before(const __shared_ptr<_Tp1, _Lp>& __rhs) const
+       { return _M_refcount._M_less(__rhs._M_refcount); }
+
+      template<typename _Tp1>
+       bool
+       owner_before(const __weak_ptr<_Tp1, _Lp>& __rhs) const
+       { return _M_refcount._M_less(__rhs._M_refcount); }
+
+      void
+      reset() // never throws
+      { __weak_ptr().swap(*this); }
+
+      void
+      swap(__weak_ptr& __s) // never throws
+      {
+       std::swap(_M_ptr, __s._M_ptr);
+       _M_refcount._M_swap(__s._M_refcount);
+      }
+
+      // Comparisons
+      template<typename _Tp1>
+       bool operator<(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+
+      template<typename _Tp1>
+       bool operator<=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+
+      template<typename _Tp1>
+       bool operator>(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+
+      template<typename _Tp1>
+       bool operator>=(const __weak_ptr<_Tp1, _Lp>&) const = delete;
+
+    private:
+      // Used by __enable_shared_from_this.
+      void
+      _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)
+      {
+       _M_ptr = __ptr;
+       _M_refcount = __refcount;
+      }
+
+      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;
+      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;
+      friend class __enable_shared_from_this<_Tp, _Lp>;
+      friend class enable_shared_from_this<_Tp>;
+
+      _Tp*              _M_ptr;         // Contained pointer.
+      __weak_count<_Lp>  _M_refcount;    // Reference counter.
+    };
+
+  // 20.8.13.3.7 weak_ptr specialized algorithms.
+  template<typename _Tp, _Lock_policy _Lp>
+    inline void
+    swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)
+    { __a.swap(__b); }
+
+  template<typename _Tp, typename _Tp1>
+    struct _Sp_owner_less : public binary_function<_Tp, _Tp, bool>
+    {
+      bool
+      operator()(const _Tp& __lhs, const _Tp& __rhs) const
+      { return __lhs.owner_before(__rhs); }
+
+      bool
+      operator()(const _Tp& __lhs, const _Tp1& __rhs) const
+      { return __lhs.owner_before(__rhs); }
+
+      bool
+      operator()(const _Tp1& __lhs, const _Tp& __rhs) const
+      { return __lhs.owner_before(__rhs); }
+    };
+
+  template<typename _Tp, _Lock_policy _Lp>
+    struct owner_less<__shared_ptr<_Tp, _Lp>>
+    : public _Sp_owner_less<__shared_ptr<_Tp, _Lp>, __weak_ptr<_Tp, _Lp>>
+    { };
+
+  template<typename _Tp, _Lock_policy _Lp>
+    struct owner_less<__weak_ptr<_Tp, _Lp>>
+    : public _Sp_owner_less<__weak_ptr<_Tp, _Lp>, __shared_ptr<_Tp, _Lp>>
+    { };
+
+
+  template<typename _Tp, _Lock_policy _Lp>
+    class __enable_shared_from_this
+    {
+    protected:
+      __enable_shared_from_this() { }
+
+      __enable_shared_from_this(const __enable_shared_from_this&) { }
+
+      __enable_shared_from_this&
+      operator=(const __enable_shared_from_this&)
+      { return *this; }
+
+      ~__enable_shared_from_this() { }
+
+    public:
+      __shared_ptr<_Tp, _Lp>
+      shared_from_this()
+      { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }
+
+      __shared_ptr<const _Tp, _Lp>
+      shared_from_this() const
+      { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }
+
+    private:
+      template<typename _Tp1>
+       void
+       _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const
+       { _M_weak_this._M_assign(__p, __n); }
+
+      template<typename _Tp1>
+       friend void
+       __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,
+                                        const __enable_shared_from_this* __pe,
+                                        const _Tp1* __px)
+       {
+         if (__pe != 0)
+           __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);
+       }
+
+      mutable __weak_ptr<_Tp, _Lp>  _M_weak_this;
+    };
+
+
+  template<typename _Tp, _Lock_policy _Lp, typename _Alloc, typename... _Args>
+    inline __shared_ptr<_Tp, _Lp>
+    __allocate_shared(_Alloc __a, _Args&&... __args)
+    {
+      return __shared_ptr<_Tp, _Lp>(_Sp_make_shared_tag(),
+         std::forward<_Alloc>(__a), std::forward<_Args>(__args)...);
+    }
+
+  template<typename _Tp, _Lock_policy _Lp, typename... _Args>
+    inline __shared_ptr<_Tp, _Lp>
+    __make_shared(_Args&&... __args)
+    {
+      typedef typename std::remove_const<_Tp>::type _Tp_nc;
+      return __allocate_shared<_Tp, _Lp>(std::allocator<_Tp_nc>(),
+                                        std::forward<_Args>(__args)...);
+    }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // _SHARED_PTR_BASE_H
index c638c547887fd8955748613725e6afe60603f673..f9c3ab2b42885752c088a8b8d38f9edf76a0892d 100644 (file)
@@ -998,7 +998,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
     }
 
   /**
-   *  @brief Performs "dictionary" comparison on ranges.
+   *  @brief Performs 'dictionary' comparison on ranges.
    *  @ingroup sorting_algorithms
    *  @param  first1  An input iterator.
    *  @param  last1   An input iterator.
@@ -1006,9 +1006,9 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
    *  @param  last2   An input iterator.
    *  @return   A boolean true or false.
    *
-   *  "Returns true if the sequence of elements defined by the range
+   *  'Returns true if the sequence of elements defined by the range
    *  [first1,last1) is lexicographically less than the sequence of elements
-   *  defined by the range [first2,last2).  Returns false otherwise."
+   *  defined by the range [first2,last2).  Returns false otherwise.'
    *  (Quoted from [25.3.8]/1.)  If the iterators are all character pointers,
    *  then this is an inline call to @c memcmp.
   */
index eb7290053ed30d267c2ba532596f49bd5967b0e9..a60fea60a6bd7af7e2d4d477f27ed2546f037728 100644 (file)
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   // 24.4.1 Reverse iterators
   /**
-   *  "Bidirectional and random access iterators have corresponding reverse
+   *  'Bidirectional and random access iterators have corresponding reverse
    *  %iterator adaptors that iterate through the data structure in the
    *  opposite direction.  They have the same signatures as the corresponding
    *  iterators.  The fundamental relation between a reverse %iterator and its
@@ -80,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *
    *  This mapping is dictated by the fact that while there is always a
    *  pointer past the end of an array, there might not be a valid pointer
-   *  before the beginning of an array." [24.4.1]/1,2
+   *  before the beginning of an array.' [24.4.1]/1,2
    *
    *  Reverse iterators can be tricky and surprising at first.  Their
    *  semantics make sense, however, and the trickiness is a side effect of
@@ -97,14 +102,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     protected:
       _Iterator current;
 
-    public:
-      typedef _Iterator                                               iterator_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                              difference_type;
-      typedef typename iterator_traits<_Iterator>::reference   reference;
-      typedef typename iterator_traits<_Iterator>::pointer     pointer;
+      typedef iterator_traits<_Iterator>               __traits_type;
 
     public:
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::difference_type  difference_type;
+      typedef typename __traits_type::pointer          pointer;
+      typedef typename __traits_type::reference                reference;
+
       /**
        *  The default constructor default-initializes member @p current.
        *  If it is a pointer, that means it is zero-initialized.
@@ -651,6 +656,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
                                         typename _Container::iterator(__i));
     }
 
+  // @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
@@ -670,15 +677,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     protected:
       _Iterator _M_current;
 
+      typedef iterator_traits<_Iterator>               __traits_type;
+
     public:
-      typedef _Iterator                                             iterator_type;
-      typedef typename iterator_traits<_Iterator>::iterator_category
-                                                             iterator_category;
-      typedef typename iterator_traits<_Iterator>::value_type  value_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                             difference_type;
-      typedef typename iterator_traits<_Iterator>::reference reference;
-      typedef typename iterator_traits<_Iterator>::pointer   pointer;
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type       value_type;
+      typedef typename __traits_type::difference_type  difference_type;
+      typedef typename __traits_type::reference        reference;
+      typedef typename __traits_type::pointer          pointer;
 
       __normal_iterator() : _M_current(_Iterator()) { }
 
@@ -869,6 +876,11 @@ _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   // 24.4.3  Move iterators
   /**
    *  Class template move_iterator is an iterator adapter with the same
@@ -884,18 +896,17 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     protected:
       _Iterator _M_current;
 
+      typedef iterator_traits<_Iterator>               __traits_type;
+
     public:
-      typedef _Iterator                                        iterator_type;
-      typedef typename iterator_traits<_Iterator>::difference_type
-                                                               difference_type;
+      typedef _Iterator                                        iterator_type;
+      typedef typename __traits_type::iterator_category iterator_category;
+      typedef typename __traits_type::value_type       value_type;
+      typedef typename __traits_type::difference_type  difference_type;
       // NB: DR 680.
-      typedef _Iterator                                        pointer;
-      typedef typename iterator_traits<_Iterator>::value_type  value_type;
-      typedef typename iterator_traits<_Iterator>::iterator_category
-                                                               iterator_category;
-      typedef value_type&&                                     reference;
+      typedef _Iterator                                        pointer;
+      typedef value_type&&                             reference;
 
-    public:
       move_iterator()
       : _M_current() { }
 
@@ -1031,6 +1042,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     make_move_iterator(const _Iterator& __i)
     { return move_iterator<_Iterator>(__i); }
 
+  // @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 #define _GLIBCXX_MAKE_MOVE_ITERATOR(_Iter) std::make_move_iterator(_Iter)
index 6dc0d7838d33377d78d6eebe4ff2a773a9f7abfb..d2bf647f05881b9c9e8a47d9828ac42170f07011 100644 (file)
@@ -77,15 +77,19 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   //@{ 
   ///  Marking input iterators.
   struct input_iterator_tag { };
+
   ///  Marking output iterators.
   struct output_iterator_tag { };
+
   /// Forward iterators support a superset of input iterator operations.
   struct forward_iterator_tag : public input_iterator_tag { };
+
   /// Bidirectional iterators support a superset of forward iterator
   /// operations.
   struct bidirectional_iterator_tag : public forward_iterator_tag { };
-  /// Random-access iterators support a superset of bidirectional iterator
-  /// operations.
+
+  /// Random-access iterators support a superset of bidirectional
+  /// iterator operations.
   struct random_access_iterator_tag : public bidirectional_iterator_tag { };
 
 
@@ -116,6 +120,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     };
 
   /**
+   *  @brief  Traits class for iterators.
+   *
    *  This class does nothing but define nested typedefs.  The general
    *  version simply "forwards" the nested typedefs from the Iterator
    *  argument.  Specialized versions for pointers and pointers-to-const
@@ -131,6 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typedef typename _Iterator::reference         reference;
     };
 
+  /// Partial specialization for pointer types.
   template<typename _Tp>
     struct iterator_traits<_Tp*>
     {
@@ -141,6 +148,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       typedef _Tp&                        reference;
     };
 
+  /// Partial specialization for const pointer types.
   template<typename _Tp>
     struct iterator_traits<const _Tp*>
     {
index 2b887912a10361d01ea3dc47e9fa144a6d1b16df..27b58bf5f81d789be2f6a57addc8a4d787f90e66 100644 (file)
@@ -72,9 +72,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
    *
    *  This function tries to obtain storage for @c len adjacent Tp
    *  objects.  The objects themselves are not constructed, of course.
-   *  A pair<> is returned containing "the buffer s address and
+   *  A pair<> is returned containing 'the buffer s address and
    *  capacity (in the units of sizeof(Tp)), or a pair of 0 values if
-   *  no storage can be obtained."  Note that the capacity obtained
+   *  no storage can be obtained.'  Note that the capacity obtained
    *  may be less than that requested if the memory is unavailable;
    *  you should compare len with the .second return value.
    *
index fce6c26d1a52401bcbb43e2c0e5ac08cfffd92d8..90f1b552b60457c14c9e60faef9ab9184581f870 100644 (file)
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   /// Provides input iterator semantics for streams.
   template<typename _Tp, typename _CharT = char,
            typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t>
@@ -206,6 +211,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       { return *this; }
     };
 
+  // @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 #endif
index d02b555343aeca117cc67224316f5117abb6f7d5..71c323035a2aa5b0be607c345a1207649d3ee0d0 100644 (file)
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
      
+  /**
+   * @addtogroup iterators
+   * @{
+   */
+
   // 24.5.3 Template class istreambuf_iterator
   /// Provides input iterator semantics for streambufs.
   template<typename _CharT, typename _Traits>
@@ -387,6 +392,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       return __first;
     }
 
+// @} group iterators
+
 _GLIBCXX_END_NAMESPACE
 
 #endif
index 186de0fbcd1fd5f5d0f103eae6bc34a70b0527d2..231e419efb54ea30d42ef49c04d580ec23d2a849 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file cassert
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c assert.h,
index 44ef4d4a0f26d39c68cfa9bbc68f39108d3de3b1..bfe45929e3c614745115440e538f0cae3a1348f9 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cctype
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c ctype.h,
index 371642936cfe007a41d1fe41dde8e1b78f62f2ce..f02d732079cd3ec041aa88ac6236b34ae6e43cdf 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file cerrno
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c errno.h,
index 54eb77887467e40e886b8527c0f0d115858f3112..7f551446cb3e621ab0a85d60138b0f22cd9d36f9 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cfloat
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c float.h,
index a3c3f9b77947e9640c112e7d391ac37fd2775cb6..bb7e6294fd8fe41ba9764f687f59062acb0e1ec7 100644 (file)
@@ -23,7 +23,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file ciso646
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c iso646.h,
index 943d69e522ffaf2286cad45fa5401e13618f9b12..1bbe6cf27a52495dc114ce619898c5677b8925d9 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/climits
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c limits.h,
index eb955c9b181d463a7948fbb71905aebbfcfbfb79..52d2b9d21487e9a7beebabef2f91de02fd144906 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file clocale
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c locale.h,
index a5c31c436d7295c76a28e898b10093c57f2e2664..2568d6b3bf66374440f7a4d756e6345fb66cbae6 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cmath
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c math.h,
index 6d7ecab47b6c233eccc647932aa671d778df3fdf..c643d1b437a05f2fc8dccd46059e48cd207a7c1f 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file csetjmp
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c setjmp.h,
index 41af5e694a4e7fb9bc21ea2df728298357ba70ed..147b5b618597fef394597d1f38753f9e2e69028c 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file csignal
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c signal.h,
index 73327b1a353d6115382032d1bb7dc95be8d7dcdc..c61a866bfe72099cee27c7b9fcfc768f4db9bca8 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cstdarg
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c stdarg.h,
index 7489d97c07d5d3d2cbf2de8faaa3e2239d291a12..c2aea8f02c23e9bd71bd884835698c4a6e122e72 100644 (file)
@@ -24,7 +24,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file cstdatomic
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c stdatomic.h,
index bb16e75e0ac6681de3f74c531810a134d30b173a..6beb52588bcbce2bf69b7c823e587f3868965c18 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file cstddef
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c stddef.h,
index ff5a635a1528943dba34343f527776e99fb20ce0..b17f5ccf86453e9fae443e83fd179db6699e78e0 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cstdio
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c stdio.h,
index e252d089e75efefd919012469032d6ca42c73aed..0e0d7d5c18ca7b03bddf63660c8f9ebf16b25ffb 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cstdlib
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c stdlib.h,
index de0ce2425e3bfedaaa908d1ba8cb4e4a8723a1d8..acd6166b15f3d0ec42d1ae935e0aea5598625694 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file cstring
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c string.h,
index e236cf48367a330afa0eee2f80903b7a2eeb0fa1..8430dc84234a65745513ec691a79e22ce7f70636 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/ctime
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c time.h,
index f7f07c3caf50f30ecdf1e70b95a15a36feecdcd4..f2f36cfc75c20a4374c093e66fc870d61535bab4 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cwchar
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c wchar.h,
index 4e94fec3426bdfc47b879961ba9b2da0fd71301c..ffc75c82ba5a9b7e1654a58ba1595a5ef7a16037 100644 (file)
@@ -25,7 +25,7 @@
 // <http://www.gnu.org/licenses/>.
 
 /** @file include/cwctype
- *  This is a Standard C++ Library file.  You should @c #include this file
+ *  This is a Standard C++ Library file.  You should @c \#include this file
  *  in your programs, rather than any of the "*.h" implementation files.
  *
  *  This is the C++ version of the Standard C Library header @c wctype.h,
index 3107d97a45b8613899dce80561d1720ef66daf2c..f3ac555908fdeb8676e81baa75e44c7647779764 100644 (file)
@@ -94,7 +94,7 @@ namespace __gnu_parallel
     *  @param __comp Comparator.
     *  @param __num_threads Number of threads that are allowed to work on
     *  this part.
-    *  @pre @__c (__end-__begin)>=1 */
+    *  @pre @c (__end-__begin)>=1 */
   template<typename _RAIter, typename _Compare>
     typename std::iterator_traits<_RAIter>::difference_type
     __qsb_divide(_RAIter __begin, _RAIter __end,
index eee88bd2ce1dc681b7d8694002a244324536ffb8..87d5752441aa915873cddfa6d80dd2a4283c8840 100644 (file)
@@ -93,7 +93,7 @@ namespace __gnu_parallel
   __is_parallel(const _Parallelism __p) { return __p != sequential; }
 
 
-  /** @brief Calculates the rounded-down logarithm of @__c __n for base 2.
+  /** @brief Calculates the rounded-down logarithm of @c __n for base 2.
    *  @param __n Argument.
    *  @return Returns 0 for any argument <1.
    */
@@ -108,11 +108,11 @@ namespace __gnu_parallel
     }
 
   /** @brief Encode two integers into one gnu_parallel::_CASable.
-   *  @param __a First integer, to be encoded in the most-significant @__c
+   *  @param __a First integer, to be encoded in the most-significant @c
    *  _CASable_bits/2 bits.
    *  @param __b Second integer, to be encoded in the least-significant
-   *  @__c _CASable_bits/2 bits.
-   *  @return value encoding @__c __a and @__c __b.
+   *  @c _CASable_bits/2 bits.
+   *  @return value encoding @c __a and @c __b.
    *  @see decode2
    */
   inline _CASable
@@ -124,9 +124,9 @@ namespace __gnu_parallel
   /** @brief Decode two integers from one gnu_parallel::_CASable.
    *  @param __x __gnu_parallel::_CASable to decode integers from.
    *  @param __a First integer, to be decoded from the most-significant
-   *  @__c _CASable_bits/2 bits of @__c __x.
+   *  @c _CASable_bits/2 bits of @c __x.
    *  @param __b Second integer, to be encoded in the least-significant
-   *  @__c _CASable_bits/2 bits of @__c __x.
+   *  @c _CASable_bits/2 bits of @c __x.
    *  @see __encode2
    */
   inline void
@@ -422,7 +422,7 @@ namespace __gnu_parallel
     };
 
   /** @brief Compute the median of three referenced elements,
-      according to @__c __comp.
+      according to @c __comp.
       *  @param __a First iterator.
       *  @param __b Second iterator.
       *  @param __c Third iterator.
index 8abfc991e678e02448af4e1eaf56ead561762f9b..2a977acedf4fb412a964c182298db75adfb1510a 100644 (file)
 namespace __gnu_parallel
 {
   /**
-   * @brief Check whether @__c [__begin, @__c __end) is sorted according
-   * to @__c __comp.
+   * @brief Check whether @c [__begin, @c __end) is sorted according
+   * to @c __comp.
    * @param __begin Begin iterator of sequence.
    * @param __end End iterator of sequence.
    * @param __comp Comparator.
-   * @return @__c true if sorted, @__c false otherwise.
+   * @return @c true if sorted, @c false otherwise.
    */
   template<typename _IIter, typename _Compare>
     bool
index c4f691e5b77d63771d94fc28ee3177d4fb01e3f6..688a7cf348f5142226ffa8484ec8b6c4a1f85732 100644 (file)
@@ -227,8 +227,8 @@ namespace __gnu_parallel
 
 #endif
 
-  /** @brief Compare @__c *__ptr and @__c __comparand. If equal, let @__c
-   * *__ptr=__replacement and return @__c true, return @__c false otherwise.
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
    *
    *  Implementation is heavily platform-dependent.
    *  @param __ptr Pointer to 32-bit signed integer.
@@ -270,8 +270,8 @@ namespace __gnu_parallel
 #endif
   }
 
-  /** @brief Compare @__c *__ptr and @__c __comparand. If equal, let @__c
-   * *__ptr=__replacement and return @__c true, return @__c false otherwise.
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
    *
    *  Implementation is heavily platform-dependent.
    *  @param __ptr Pointer to 64-bit signed integer.
@@ -323,8 +323,8 @@ namespace __gnu_parallel
 #endif
   }
 
-  /** @brief Compare @__c *__ptr and @__c __comparand. If equal, let @__c
-   * *__ptr=__replacement and return @__c true, return @__c false otherwise.
+  /** @brief Compare @c *__ptr and @c __comparand. If equal, let @c
+   * *__ptr=__replacement and return @c true, return @c false otherwise.
    *
    *  Implementation is heavily platform-dependent.
    *  @param __ptr Pointer to signed integer.
index 307be0b52f0ef002c7d243ef1624f6467f6bd27c..481c9886840b3da3b9af33ac3ec9e2b4f077b8f4 100644 (file)
@@ -42,7 +42,7 @@ namespace __gnu_parallel
    *  @param __n Number of elements
    *  @param __num_threads Number of parts
    *  @param __s Splitters
-   *  @returns End of __splitter sequence, i.e. @__c __s+__num_threads+1 */
+   *  @returns End of __splitter sequence, i.e. @c __s+__num_threads+1 */
   template<typename _DifferenceType, typename _OutputIterator>
     _OutputIterator
     equally_split(_DifferenceType __n, _ThreadIndex __num_threads,
index f758b7ab78ae9d02180642fe22edb0d09eba99bb..e6e573ddbbf939d0625275fbe67782190994da40 100644 (file)
@@ -42,7 +42,7 @@
 
 namespace __gnu_parallel
 {
-  /** @brief Chose the desired algorithm by evaluating @__c __parallelism_tag.
+  /** @brief Chose the desired algorithm by evaluating @c __parallelism_tag.
    *  @param __begin Begin iterator of input sequence.
    *  @param __end End iterator of input sequence.
    *  @param __user_op A user-specified functor (comparator, predicate,
index 573085aa87211787f024d0e452629cbb573d1efc..1f1bfa22e443d018b59ea2a54eef1d81ff2aa06f 100644 (file)
@@ -42,7 +42,7 @@ namespace __gnu_parallel
    *  @param __os_starts Start positions worked on (oversampled).
    *  @param __count_to_two Counts up to 2.
    *  @param __range_length Current length of a chunk.
-   *  @param __make_twice Whether the @__c __os_starts is allowed to be
+   *  @param __make_twice Whether the @c __os_starts is allowed to be
    *  grown or not
    */
   template<typename _IIter>
@@ -83,16 +83,17 @@ namespace __gnu_parallel
    *  @param __begin Begin iterator of input sequence.
    *  @param __end End iterator of input sequence.
    *  @param __starts Start iterators for the resulting parts, dimension
-   *  @__c __num_parts+1. For convenience, @__c __starts @__c [__num_parts]
+   *  @c __num_parts+1. For convenience, @c __starts @c [__num_parts]
    *  contains the end iterator of the sequence.
    *  @param __lengths Length of the resulting parts.
    *  @param __num_parts Number of parts to split the sequence into.
    *  @param __f Functor to be applied to each element by traversing __it
    *  @param __oversampling Oversampling factor. If 0, then the
-   *  partitions will differ in at most @__f$ \sqrt{\mathrm{__end} -
-   *  \mathrm{__begin}} @__f$ __elements. Otherwise, the ratio between the
-   *  longest and the shortest part is bounded by @__f$
-   *  1/(\mathrm{__oversampling} \cdot \mathrm{num\_parts}) @__f$.
+   *  partitions will differ in at most 
+   *  \sqrt{\mathrm{__end} - \mathrm{__begin}} 
+   *  __elements. Otherwise, the ratio between the
+   *  longest and the shortest part is bounded by
+   *  1/(\mathrm{__oversampling} \cdot \mathrm{num\_parts})
    *  @return Length of the whole sequence.
    */
   template<typename _IIter, typename _FunctorType>
index 2343d7326e8cfac06a86b80c004397625b6d7edd..a19e996a0555351913c08284d39a96be2565a84d 100644 (file)
 
 namespace __gnu_parallel
 {
-  /** @brief Merge routine being able to merge only the @__c __max_length
+  /** @brief Merge routine being able to merge only the @c __max_length
    * smallest elements.
    *
-   * The @__c __begin iterators are advanced accordingly, they might not
-   * reach @__c __end, in contrast to the usual variant.
+   * The @c __begin iterators are advanced accordingly, they might not
+   * reach @c __end, in contrast to the usual variant.
    * @param __begin1 Begin iterator of first sequence.
    * @param __end1 End iterator of first sequence.
    * @param __begin2 Begin iterator of second sequence.
@@ -83,11 +83,11 @@ namespace __gnu_parallel
       return __target;
     }
 
-  /** @brief Merge routine being able to merge only the @__c __max_length
+  /** @brief Merge routine being able to merge only the @c __max_length
    * smallest elements.
    *
-   * The @__c __begin iterators are advanced accordingly, they might not
-   * reach @__c __end, in contrast to the usual variant.
+   * The @c __begin iterators are advanced accordingly, they might not
+   * reach @c __end, in contrast to the usual variant.
    * Specially designed code should allow the compiler to generate
    * conditional moves instead of branches.
    * @param __begin1 Begin iterator of first sequence.
@@ -150,11 +150,11 @@ namespace __gnu_parallel
       return __target;
     }
 
-  /** @brief Merge routine being able to merge only the @__c __max_length
+  /** @brief Merge routine being able to merge only the @c __max_length
    * smallest elements.
    *
-   *  The @__c __begin iterators are advanced accordingly, they might not
-   *  reach @__c __end, in contrast to the usual variant.
+   *  The @c __begin iterators are advanced accordingly, they might not
+   *  reach @c __end, in contrast to the usual variant.
    *  Static switch on whether to use the conditional-move variant.
    *  @param __begin1 Begin iterator of first sequence.
    *  @param __end1 End iterator of first sequence.
@@ -202,11 +202,11 @@ namespace __gnu_parallel
     { return __merge_advance(__begin1, __end1, __begin2, __end2, __target,
                             __max_length, __comp); }
 
-  /** @brief Parallel merge routine being able to merge only the @__c
+  /** @brief Parallel merge routine being able to merge only the @c
    * __max_length smallest elements.
    *
-   *  The @__c __begin iterators are advanced accordingly, they might not
-   *  reach @__c __end, in contrast to the usual variant.
+   *  The @c __begin iterators are advanced accordingly, they might not
+   *  reach @c __end, in contrast to the usual variant.
    *  The functionality is projected onto parallel_multiway_merge.
    *  @param __begin1 Begin iterator of first sequence.
    *  @param __end1 End iterator of first sequence.
index 4238a1c6923f3ddd392ea46a95dd5614e9afaba9..cdf21540d12f93f42d46bd5d144613dce0d8bb62 100644 (file)
@@ -108,7 +108,7 @@ namespace __gnu_parallel
       /** @brief Compare two elements referenced by guarded iterators.
        *  @param __bi1 First iterator.
        *  @param __bi2 Second iterator.
-       *  @return @__c true if less. */
+       *  @return @c true if less. */
       friend bool
       operator<(_GuardedIterator<_RAIter, _Compare>& __bi1,
                _GuardedIterator<_RAIter, _Compare>& __bi2)
@@ -123,7 +123,7 @@ namespace __gnu_parallel
       /** @brief Compare two elements referenced by guarded iterators.
        *  @param __bi1 First iterator.
        *  @param __bi2 Second iterator.
-       *  @return @__c True if less equal. */
+       *  @return @c True if less equal. */
       friend bool
       operator<=(_GuardedIterator<_RAIter, _Compare>& __bi1,
                 _GuardedIterator<_RAIter, _Compare>& __bi2)
@@ -178,7 +178,7 @@ namespace __gnu_parallel
       /** @brief Compare two elements referenced by unguarded iterators.
        *  @param __bi1 First iterator.
        *  @param __bi2 Second iterator.
-       *  @return @__c true if less. */
+       *  @return @c true if less. */
       friend bool
       operator<(_UnguardedIterator<_RAIter, _Compare>& __bi1,
                _UnguardedIterator<_RAIter, _Compare>& __bi2)
@@ -190,7 +190,7 @@ namespace __gnu_parallel
       /** @brief Compare two elements referenced by unguarded iterators.
        *  @param __bi1 First iterator.
        *  @param __bi2 Second iterator.
-       *  @return @__c True if less equal. */
+       *  @return @c True if less equal. */
       friend bool
       operator<=(_UnguardedIterator<_RAIter, _Compare>& __bi1,
                 _UnguardedIterator<_RAIter, _Compare>& __bi2)
@@ -1724,7 +1724,7 @@ namespace __gnu_parallel
    * @pre All input sequences must be sorted.
    * @pre Target must provide enough space to merge out length elements or
    *    the number of elements in all sequences, whichever is smaller.
-   * @pre For each @__c __i, @__c __seqs_begin[__i].second must be the end
+   * @pre For each @c __i, @c __seqs_begin[__i].second must be the end
    *    marker of the sequence, but also reference the one more __sentinel
    *    element.
    *
index 1f2c43db61f1731688fe71bd42b14c0de0eeb7b1..f2bb6fbc30dfe640597fed26906457ebd0987da1 100644 (file)
@@ -82,14 +82,14 @@ namespace __gnu_parallel
       /** @brief Offsets to add to the found positions. */
       _DifferenceType* _M_offsets;
 
-      /** @brief Pieces of data to merge @__c [thread][__sequence] */
+      /** @brief Pieces of data to merge @c [thread][__sequence] */
       std::vector<_Piece<_DifferenceType> >* _M_pieces;
   };
 
   /**
    *  @brief Select _M_samples from a sequence.
    *  @param __sd Pointer to algorithm data. _Result will be placed in
-   *  @__c __sd->_M_samples.
+   *  @c __sd->_M_samples.
    *  @param __num_samples Number of _M_samples to select.
    */
   template<typename _RAIter, typename _DifferenceTp>
index ff5deb09383ab0a9312757d21b91490c9aeca806..28c78600860abfa5c91c4c83d3f95aeedb221c6f 100644 (file)
@@ -45,7 +45,7 @@ namespace __gnu_parallel
    *  atomic access.  push_front() and pop_front() must not be called
    *  concurrently to each other, while pop_back() can be called
    *  concurrently at all times.
-   *  @__c empty(), @__c size(), and @__c top() are intentionally not provided.
+   *  @c empty(), @c size(), and @c top() are intentionally not provided.
    *  Calling them would not make sense in a concurrent setting.
    *  @param _Tp Contained element type. */
   template<typename _Tp>
index 4df91df0583e6589ce34380d21fc6d6ad9111a5b..c39f15e129812e0212659d63c5a464e26e2a8429 100644 (file)
@@ -81,7 +81,7 @@ namespace __gnu_parallel
     /** @brief Constructor.
      *  @param __seed Random __seed.
      *  @param _M_supremum Generate integer random numbers in the
-     *                  interval @__c [0,_M_supremum). */
+     *                  interval @c [0,_M_supremum). */
     _RandomNumber(uint32_t __seed, uint64_t _M_supremum = 0x100000000ULL)
     : _M_mt(__seed), _M_supremum(_M_supremum),
       _M_rand_sup(1ULL << std::numeric_limits<uint32_t>::digits),
@@ -95,7 +95,7 @@ namespace __gnu_parallel
     { return __scale_down(_M_mt(), _M_supremum, _M_supremum_reciprocal); }
 
     /** @brief Generate unsigned random 32-bit integer in the
-        interval @__c [0,local_supremum). */
+        interval @c [0,local_supremum). */
     uint32_t
     operator()(uint64_t local_supremum)
     {
index 137414f20f9fad14f68bafa8158cdbf511c4c603..3082ea8dbc0306e0266f9a05af8718f24a8782a6 100644 (file)
@@ -106,7 +106,7 @@ namespace __gnu_parallel
       _DRandomShufflingGlobalData<_RAIter>* _M_sd;
     };
 
-  /** @brief Generate a random number in @__c [0,2^__logp).
+  /** @brief Generate a random number in @c [0,2^__logp).
     *  @param __logp Logarithm (basis 2) of the upper range __bound.
     *  @param __rng Random number generator to use.
     */
index 4ac155d923fc14b314c292b44c1cd829d5e53c30..9e0db3a9584a0d02037ae7d1abbcdd2ed709cec9 100644 (file)
@@ -66,7 +66,7 @@ namespace __gnu_parallel
        *  Changed by owning thread only. */
       _GLIBCXX_JOB_VOLATILE _DifferenceType _M_last;
 
-      /** @brief Number of elements, i.e. @__c _M_last-_M_first+1.
+      /** @brief Number of elements, i.e. @c _M_last-_M_first+1.
        *
        *  Changed by owning thread only. */
       _GLIBCXX_JOB_VOLATILE _DifferenceType _M_load;
index 2192879325eb8cb3cbf8484ba31ea661282a8b82..bfbafc14f90517ccc2220f4a38c5893b57367c5e 100644 (file)
@@ -28,7 +28,7 @@
 // reasons why the executable file might be covered by the GNU General
 // Public License.
 
-/** @file profile/impl/profiler_hashtable_size.cc
+/** @file profile/impl/profiler_hashtable_size.h
  *  @brief Collection of hashtable size traces.
  */
 
index 64c10db616c3b30401571271f41e606a25e7f88c..03065715463873c6e52a382af4a4937f5ee32fbf 100644 (file)
@@ -28,7 +28,7 @@
 // reasons why the executable file might be covered by the GNU General
 // Public License.
 
-/** @file profile/impl/profiler_state.cc
+/** @file profile/impl/profiler_state.h
  *  @brief Global profiler state.
  */
 
index 9bba0ab6bfcda174c642bde536dfef2e2651e2e9..b3405d7f1d5fdaeb5531b8e8c0025681ab9f3e61 100644 (file)
 
 _GLIBCXX_BEGIN_NAMESPACE(std)
 
+  /** 
+   *  @defgroup io I/O
+   *
+   *  Nearly all of the I/O classes are parameterized on the type of
+   *  characters they read and write.  (The major exception is ios_base at
+   *  the top of the hierarchy.)  This is a change from pre-Standard
+   *  streams, which were not templates.
+   *
+   *  For ease of use and compatibility, all of the basic_* I/O-related
+   *  classes are given typedef names for both of the builtin character
+   *  widths (wide and narrow).  The typedefs are the same as the
+   *  pre-Standard names, for example:
+   *
+   *  @code
+   *     typedef basic_ifstream<char>  ifstream;
+   *  @endcode
+   *
+   *  Because properly forward-declaring these classes can be difficult, you
+   *  should not do it yourself.  Instead, include the &lt;iosfwd&gt;
+   *  header, which contains only declarations of all the I/O classes as
+   *  well as the typedefs.  Trying to forward-declare the typedefs
+   *  themselves (e.g., "class ostream;") is not valid ISO C++.
+   *
+   *  For more specific declarations, see
+   *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
+   *
+   *  @{
+  */
+  class ios_base; 
+
   template<typename _CharT, typename _Traits = char_traits<_CharT> >
     class basic_ios;
 
@@ -94,36 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
 
   // _GLIBCXX_RESOLVE_LIB_DEFECTS
   // Not included.   (??? Apparently no LWG number?)
-  class ios_base; 
 
-  /** 
-   *  @defgroup io I/O
-   *
-   *  Nearly all of the I/O classes are parameterized on the type of
-   *  characters they read and write.  (The major exception is ios_base at
-   *  the top of the hierarchy.)  This is a change from pre-Standard
-   *  streams, which were not templates.
-   *
-   *  For ease of use and compatibility, all of the basic_* I/O-related
-   *  classes are given typedef names for both of the builtin character
-   *  widths (wide and narrow).  The typedefs are the same as the
-   *  pre-Standard names, for example:
-   *
-   *  @code
-   *     typedef basic_ifstream<char>  ifstream;
-   *  @endcode
-   *
-   *  Because properly forward-declaring these classes can be difficult, you
-   *  should not do it yourself.  Instead, include the &lt;iosfwd&gt;
-   *  header, which contains only declarations of all the I/O classes as
-   *  well as the typedefs.  Trying to forward-declare the typedefs
-   *  themselves (e.g., "class ostream;") is not valid ISO C++.
-   *
-   *  For more specific declarations, see
-   *  http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt11ch24.html
-   *
-   *  @{
-  */
   typedef basic_ios<char>              ios;            ///< @isiosfwd
   typedef basic_streambuf<char>        streambuf;      ///< @isiosfwd
   typedef basic_istream<char>          istream;        ///< @isiosfwd
index 41bf806d5eb771cc5cfadef8630c120527f6bc39..1f3f078d0f04b471cdff8fda62ecc78eab3c37d7 100644 (file)
@@ -203,9 +203,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
      *  Is this supposed to be "if the type is integral"?
     */
     static const bool is_integer = false;
-    /** True if the type uses an exact representation.  "All integer types are
+    /** True if the type uses an exact representation.  'All integer types are
         exact, but not all exact types are integer.  For example, rational and
-        fixed-exponent representations are exact but not integer."
+        fixed-exponent representations are exact but not integer.'
         [18.2.1.2]/15  */
     static const bool is_exact = false;
     /** For integer types, specifies the base of the representation.  For
@@ -229,23 +229,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     /** True if the type has a representation for positive infinity.  */
     static const bool has_infinity = false;
     /** True if the type has a representation for a quiet (non-signaling)
-        "Not a Number."  */
+        'Not a Number.'  */
     static const bool has_quiet_NaN = false;
     /** True if the type has a representation for a signaling
-        "Not a Number."  */
+        'Not a Number.'  */
     static const bool has_signaling_NaN = false;
     /** See std::float_denorm_style for more information.  */
     static const float_denorm_style has_denorm = denorm_absent;
-    /** "True if loss of accuracy is detected as a denormalization loss,
-        rather than as an inexact result." [18.2.1.2]/42  */
+    /** 'True if loss of accuracy is detected as a denormalization loss,
+        rather than as an inexact result.' [18.2.1.2]/42  */
     static const bool has_denorm_loss = false;
 
     /** True if-and-only-if the type adheres to the IEC 559 standard, also
         known as IEEE 754.  (Only makes sense for floating point types.)  */
     static const bool is_iec559 = false;
-    /** "True if the set of values representable by the type is finite.   All
+    /** 'True if the set of values representable by the type is finite.   All
         built-in types are bounded, this member would be false for arbitrary
-       precision types." [18.2.1.2]/54  */
+       precision types.' [18.2.1.2]/54  */
     static const bool is_bounded = false;
     /** True if the type is @e modulo, that is, if it is possible to add two
         positive numbers and have a result that wraps around to a third number
index 9defd487c60faca70ee5af978144b942f43fdc29..3e7d4e8466b9b1ca3db1a51067f18e4f8d55c640 100644 (file)
 
 #pragma GCC system_header
 
+/**
+ * @defgroup memory Memory
+ * @ingroup utilities
+ *
+ * Components for memory allocation, deallocation, and management.
+ */
+
+/**
+ * @defgroup pointer_abstractions Pointer Abstractions
+ * @ingroup memory
+ *
+ * Smart pointers, etc.
+ */
+
 #include <bits/stl_algobase.h>
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
 #  include <ext/concurrence.h>
 #  include <bits/functexcept.h>
 #  include <bits/stl_function.h>  // std::less
-#  include <bits/unique_ptr.h>
-#  include <debug/debug.h>
 #  include <type_traits>
 #  include <functional>
+#  include <debug/debug.h>
+#  include <bits/unique_ptr.h>
 #  if _GLIBCXX_DEPRECATED
 #    include <backward/auto_ptr.h>
 #  endif
 #  if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
 #    include <tr1_impl/boost_sp_counted_base.h>
-#    include <bits/shared_ptr.h>
 #  else
 #    define _GLIBCXX_INCLUDE_AS_CXX0X
 #    define _GLIBCXX_BEGIN_NAMESPACE_TR1
 #    define _GLIBCXX_END_NAMESPACE_TR1
 #    define _GLIBCXX_TR1
 #    include <tr1_impl/boost_sp_counted_base.h>
-#    include <bits/shared_ptr.h>
 #    undef _GLIBCXX_TR1
 #    undef _GLIBCXX_END_NAMESPACE_TR1
 #    undef _GLIBCXX_BEGIN_NAMESPACE_TR1
 #    undef _GLIBCXX_INCLUDE_AS_CXX0X
 #  endif
+#  include <bits/shared_ptr.h>
 #else
 #  include <backward/auto_ptr.h>
 #endif
 
-/**
- * @defgroup memory Memory
- * @ingroup utilities
- *
- * Components for memory allocation, deallocation, and management.
- */
-
 #endif /* _GLIBCXX_MEMORY */
index f5e3191c4cda3c573019f6d8991e84a8a3642169..0ebf506d0c7f247af0322d2892b1b9b76a9443cd 100644 (file)
@@ -112,9 +112,9 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  @brief  Copying out the string buffer.
        *  @return  A copy of one of the underlying sequences.
        *
-       *  "If the buffer is only created in input mode, the underlying
+       *  'If the buffer is only created in input mode, the underlying
        *  character sequence is equal to the input sequence; otherwise, it
-       *  is equal to the output sequence." [27.7.1.2]/1
+       *  is equal to the output sequence.' [27.7.1.2]/1
       */
       __string_type
       str() const
index 790be0ec4d4eca704b89b047967f7813938edd76..7d6b8c789cbf73c422290ac76a15d0e7ae8c0c30 100644 (file)
@@ -341,7 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  @return  The previous character, if possible.
        *
        *  Similar to sungetc(), but @a c is pushed onto the stream instead
-       *  of "the previous character".  If successful, the next character
+       *  of 'the previous character.'  If successful, the next character
        *  fetched from the input stream will be @a c.
       */
       int_type 
@@ -366,8 +366,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *
        *  If a putback position is available, this function decrements the
        *  input pointer and returns that character.  Otherwise, calls and
-       *  returns pbackfail().  The effect is to "unget" the last character
-       *  "gotten".
+       *  returns pbackfail().  The effect is to 'unget' the last character
+       *  'gotten.'
       */
       int_type 
       sungetc()
@@ -541,10 +541,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  @param  loc  A new locale.
        *
        *  Translations done during I/O which depend on the current locale
-       *  are changed by this call.  The standard adds, "Between invocations
+       *  are changed by this call.  The standard adds, 'Between invocations
        *  of this function a class derived from streambuf can safely cache
        *  results of calls to locale functions and to members of facets
-       *  so obtained."
+       *  so obtained.'
        *
        *  @note  Base class version does nothing.
       */
@@ -608,18 +608,18 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  @return  An estimate of the number of characters available in the
        *           input sequence, or -1.
        *
-       *  "If it returns a positive value, then successive calls to
+       *  'If it returns a positive value, then successive calls to
        *  @c underflow() will not return @c traits::eof() until at least that
        *  number of characters have been supplied.  If @c showmanyc()
-       *  returns -1, then calls to @c underflow() or @c uflow() will fail."
+       *  returns -1, then calls to @c underflow() or @c uflow() will fail.'
        *  [27.5.2.4.3]/1
        *
        *  @note  Base class version does nothing, returns zero.
-       *  @note  The standard adds that "the intention is not only that the
+       *  @note  The standard adds that 'the intention is not only that the
        *         calls [to underflow or uflow] will not return @c eof() but
-       *         that they will return "immediately".
-       *  @note  The standard adds that "the morphemes of @c showmanyc are
-       *         "es-how-many-see", not "show-manic".
+       *         that they will return immediately.'
+       *  @note  The standard adds that 'the morphemes of @c showmanyc are
+       *         'es-how-many-see', not 'show-manic'.'
       */
       virtual streamsize 
       showmanyc() { return 0; }
@@ -646,7 +646,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *
        *  Informally, this function is called when the input buffer is
        *  exhausted (or does not exist, as buffering need not actually be
-       *  done).  If a buffer exists, it is "refilled".  In either case, the
+       *  done).  If a buffer exists, it is 'refilled'.  In either case, the
        *  next available character is returned, or @c traits::eof() to
        *  indicate a null pending sequence.
        *
@@ -690,7 +690,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
       /**
        *  @brief  Tries to back up the input sequence.
        *  @param  c  The character to be inserted back into the sequence.
-       *  @return  eof() on failure, "some other value" on success
+       *  @return  eof() on failure, 'some other value' on success
        *  @post  The constraints of @c gptr(), @c eback(), and @c pptr()
        *         are the same as for @c underflow().
        *
@@ -726,7 +726,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *
        *  Informally, this function is called when the output buffer is full
        *  (or does not exist, as buffering need not actually be done).  If a
-       *  buffer exists, it is "consumed", with "some effect" on the
+       *  buffer exists, it is 'consumed', with 'some effect' on the
        *  controlled sequence.  (Typically, the buffer is written out to the
        *  sequence verbatim.)  In either case, the character @a c is also
        *  written out, if @a c is not @c eof().
index 2824638354a087e281e0fe61efb4b540f138b328..788edf66cff6e7f4ac731a770756abfcbd7ec857 100644 (file)
@@ -57,7 +57,8 @@
 
 namespace std
 {
-  /** @addtogroup metaprogramming
+  /**
+   * @addtogroup metaprogramming
    * @{
    */
 
@@ -154,7 +155,7 @@ namespace std
 
   template<typename _Tp>
     struct __is_signed_helper<_Tp, true, false>
-    : public integral_constant<bool, _Tp(-1) < _Tp(0)>
+    : public integral_constant<bool, static_cast<bool>(_Tp(-1) < _Tp(0))>
     { };
 
   /// is_signed
index 1a6d0b1b6b52fe59d28f65b05e11bcb456d612b2..c3826eaca6b1d108bbb90bc580b7e2892a10bde8 100644 (file)
 
 #pragma GCC system_header
 
+/**
+ * @defgroup utilities Utilities
+ *
+ * Components deemed generally useful. Includes pair, tuple,
+ * forward/move helpers, ratio, function object, metaprogramming and
+ * type traits, time, date, and memory functions.
+ */
+
 #include <bits/c++config.h>
 #include <bits/stl_relops.h>
 #include <bits/stl_pair.h>
 #  include <initializer_list>
 #endif
 
-/**
- * @defgroup utilities Utilities
- *
- * Components deemed generally useful. Includes pair, tuple,
- * forward/move helpers, ratio, function object, metaprogramming and
- * type traits, time, date, and memory functions.
- */
-
 #endif /* _GLIBCXX_UTILITY */
index 0afce01557b9f5f554403806a9abdd7fb105e067..ba2cacae4ed79a320be41a319fe73dbf7ebb1fad 100644 (file)
@@ -57,16 +57,12 @@ namespace std
 {
 namespace tr1
 {
-
   template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>
     class _Sp_counted_base_impl
     : public _Sp_counted_base<_Lp>
     {
     public:
-      /**
-       *  @brief   
-       *  @pre     __d(__p) must not throw.
-       */
+      // Precondition: __d(__p) must not throw.
       _Sp_counted_base_impl(_Ptr __p, _Deleter __d)
       : _M_ptr(__p), _M_del(__d) { }
     
@@ -346,31 +342,19 @@ namespace tr1
   struct __const_cast_tag { };
   struct __dynamic_cast_tag { };
 
-  /**
-   *  @class __shared_ptr 
-   *
-   *  A smart pointer with reference-counted copy semantics.
-   *  The object pointed to is deleted when the last shared_ptr pointing to
-   *  it is destroyed or reset.
-   */
+  // A smart pointer with reference-counted copy semantics.  The
+  // object pointed to is deleted when the last shared_ptr pointing to
+  // it is destroyed or reset.
   template<typename _Tp, _Lock_policy _Lp>
     class __shared_ptr
     {
     public:
       typedef _Tp   element_type;
       
-      /** @brief  Construct an empty %__shared_ptr.
-       *  @post   use_count()==0 && get()==0
-       */
       __shared_ptr()
       : _M_ptr(0), _M_refcount() // never throws
       { }
 
-      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p.
-       *  @param  __p  A pointer that is convertible to element_type*.
-       *  @post   use_count() == 1 && get() == __p
-       *  @throw  std::bad_alloc, in which case @c delete @a __p is called.
-       */
       template<typename _Tp1>
         explicit
         __shared_ptr(_Tp1* __p)
@@ -381,19 +365,6 @@ namespace tr1
          __enable_shared_from_this_helper(_M_refcount, __p, __p);
        }
 
-      //
-      // Requirements: _Deleter's copy constructor and destructor must
-      // not throw
-      //
-      // __shared_ptr will release __p by calling __d(__p)
-      //
-      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p
-       *          and the deleter @a __d.
-       *  @param  __p  A pointer.
-       *  @param  __d  A deleter.
-       *  @post   use_count() == 1 && get() == __p
-       *  @throw  std::bad_alloc, in which case @a __d(__p) is called.
-       */
       template<typename _Tp1, typename _Deleter>
         __shared_ptr(_Tp1* __p, _Deleter __d)
         : _M_ptr(__p), _M_refcount(__p, __d)
@@ -405,24 +376,11 @@ namespace tr1
       
       //  generated copy constructor, assignment, destructor are fine.
       
-      /** @brief  If @a __r is empty, constructs an empty %__shared_ptr;
-       *          otherwise construct a %__shared_ptr that shares ownership
-       *          with @a __r.
-       *  @param  __r  A %__shared_ptr.
-       *  @post   get() == __r.get() && use_count() == __r.use_count()
-       */
       template<typename _Tp1>
         __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)
        : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws
         { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }
 
-      /** @brief  Constructs a %__shared_ptr that shares ownership with @a __r
-       *          and stores a copy of the pointer stored in @a __r.
-       *  @param  __r  A weak_ptr.
-       *  @post   use_count() == __r.use_count()
-       *  @throw  bad_weak_ptr when __r.expired(),
-       *          in which case the constructor has no effect.
-       */
       template<typename _Tp1>
         explicit
         __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)
@@ -435,9 +393,7 @@ namespace tr1
        }
 
 #if !defined(__GXX_EXPERIMENTAL_CXX0X__) || _GLIBCXX_DEPRECATED
-      /**
-       * @post use_count() == 1 and __r.get() == 0
-       */
+      // Postcondition: use_count() == 1 and __r.get() == 0
       template<typename _Tp1>
         explicit
         __shared_ptr(std::auto_ptr<_Tp1>& __r)
@@ -595,30 +551,30 @@ namespace tr1
     { __a.swap(__b); }
 
   // 2.2.3.9 shared_ptr casts
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))
+   *  will eventually result in undefined behaviour,
+   *  attempting to delete the same object twice.
    */
   template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
     inline __shared_ptr<_Tp, _Lp>
     static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
     { return __shared_ptr<_Tp, _Lp>(__r, __static_cast_tag()); }
 
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))
+   *  will eventually result in undefined behaviour,
+   *  attempting to delete the same object twice.
    */
   template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
     inline __shared_ptr<_Tp, _Lp>
     const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)
     { return __shared_ptr<_Tp, _Lp>(__r, __const_cast_tag()); }
 
-  /** @warning The seemingly equivalent
-   *           <code>shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))</code>
-   *           will eventually result in undefined behaviour,
-   *           attempting to delete the same object twice.
+  /*  The seemingly equivalent
+   *           shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))
+   *  will eventually result in undefined behaviour,
+   *  attempting to delete the same object twice.
    */
   template<typename _Tp, typename _Tp1, _Lock_policy _Lp>
     inline __shared_ptr<_Tp, _Lp>
@@ -825,7 +781,6 @@ namespace tr1
     };
 
 
-  /// shared_ptr
   // The actual shared_ptr, with forwarding constructors and
   // assignment operators.
   template<typename _Tp>
@@ -914,7 +869,6 @@ namespace tr1
     { return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); }
 
 
-  /// weak_ptr
   // The actual weak_ptr, with forwarding constructors and
   // assignment operators.
   template<typename _Tp>
@@ -971,7 +925,6 @@ namespace tr1
       }
     };
 
-  /// enable_shared_from_this
   template<typename _Tp>
     class enable_shared_from_this
     {
@@ -1013,7 +966,6 @@ namespace tr1
 
       mutable weak_ptr<_Tp>  _M_weak_this;
     };
-
 }
 }
 
index 48e601f2171df27557d404fe776fa05581e59b71..56030856dca639caa2e56489be5aa860c617f58c 100644 (file)
@@ -51,6 +51,10 @@ namespace std
 {
 _GLIBCXX_BEGIN_NAMESPACE_TR1
 
+ /**
+   *  @brief  Exception possibly thrown by @c shared_ptr.
+   *  @ingroup exceptions
+   */
   class bad_weak_ptr : public std::exception
   {
   public:
index 6f76a98141962a15f2debebc6760b51053147eee..8df62c212cc38cc48353bb7b61eb38a547102d19 100644 (file)
@@ -135,9 +135,9 @@ namespace regex_constants
    * Specifies that the grammar recognized by the regular expression engine is
    * that used by POSIX utility awk in IEEE Std 1003.1-2001.  This option is
    * identical to syntax_option_type extended, except that C-style escape
-   * sequences are supported.  These sequences are, explicitly, "\\", "\a",
-   * "\b", "\f", "\n", "\r", "\t" , "\v", "\"", "'",
-   * and "\ddd" (where ddd is one, two, or three octal digits).  
+   * sequences are supported.  These sequences are, explicitly, '\\', '\a',
+   * '\b', '\f', '\n', '\r', '\t' , '\v', '\'', ''',
+   * and '\ddd' (where ddd is one, two, or three octal digits).  
    */
   static const syntax_option_type awk        = 1 << _S_awk;
 
@@ -202,26 +202,26 @@ namespace regex_constants
 
   /**
    * The first character in the sequence [first, last) is treated as though it
-   * is not at the beginning of a line, so the character "^" in the regular
+   * is not at the beginning of a line, so the character '^' in the regular
    * expression shall not match [first, first).
    */
   static const match_flag_type match_not_bol     = 1 << _S_not_bol;
 
   /**
    * The last character in the sequence [first, last) is treated as though it
-   * is not at the end of a line, so the character "$" in the regular
+   * is not at the end of a line, so the character '$' in the regular
    * expression shall not match [last, last).
    */
   static const match_flag_type match_not_eol     = 1 << _S_not_eol;
    
   /**
-   * The expression "\b" is not matched against the sub-sequence
+   * The expression '\b' is not matched against the sub-sequence
    * [first,first).
    */
   static const match_flag_type match_not_bow     = 1 << _S_not_bow;
    
   /**
-   * The expression "\b" should not be matched against the sub-sequence
+   * The expression '\b' should not be matched against the sub-sequence
    * [last,last).
    */
   static const match_flag_type match_not_eow     = 1 << _S_not_eow;
@@ -363,7 +363,7 @@ namespace regex_constants
   static const error_type error_space(_S_error_space);
 
   /**
-   * One of "*?+{" was not preceded by a valid regular expression.
+   * One of '*?+{' was not preceded by a valid regular expression.
    */
   static const error_type error_badrepeat(_S_error_badrepeat);
 
@@ -2532,7 +2532,7 @@ namespace regex_constants
 
   // [7.12.2] Class template regex_token_iterator
   /**
-   * Iterates over submatches in a range (or "splits" a text string).
+   * Iterates over submatches in a range (or 'splits' a text string).
    *
    * The purpose of this iterator is to enumerate all, or all specified,
    * matches of a regular expression within a text range.  The dereferenced
index 75b85ea2f82813f5825f136021a69f03ba813461..47f5e8f7e602e698fd2f15df4769fd7eb354b9c9 100644 (file)
@@ -497,5 +497,6 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
 #undef _DEFINE_SPEC
 
   // @} group metaprogramming
+
 _GLIBCXX_END_NAMESPACE_TR1
 }
index 834e434e1e15fd74650744bef6a4c2b05f00ea75..18861609040f3d9eef11a7aa95e867e288a01f36 100644 (file)
@@ -582,7 +582,7 @@ namespace __cxxabiv1
 /** @namespace abi
  *  @brief The cross-vendor C++ Application Binary Interface. A
  *  namespace alias to __cxxabiv1, but user programs should use the
- *  alias `abi'.
+ *  alias 'abi'.
  *
  *  A brief overview of an ABI is given in the libstdc++ FAQ, question
  *  5.8 (you may have a copy of the FAQ locally, or you can view the online
@@ -594,10 +594,10 @@ namespace __cxxabiv1
  *  along with the current specification.
  *
  *  For users of GCC greater than or equal to 3.x, entry points are
- *  available in <cxxabi.h>, which notes, <em>"It is not normally
+ *  available in <cxxabi.h>, which notes, <em>'It is not normally
  *  necessary for user programs to include this header, or use the
  *  entry points directly.  However, this header is available should
- *  that be needed."</em>
+ *  that be needed.'</em>
 */
 namespace abi = __cxxabiv1;
 
index 26dbf0da1ec03b01817028b5349dffd2aace6d80..989a9ff6f74782d1ab0dca0977b49c1536d78c3f 100644 (file)
@@ -102,15 +102,16 @@ namespace std
    *  violates the function's %exception specification.  */
   void unexpected() __attribute__ ((__noreturn__));
 
-  /** [18.6.4]/1:  "Returns true after completing evaluation of a
+  /** [18.6.4]/1:  'Returns true after completing evaluation of a
    *  throw-expression until either completing initialization of the
    *  exception-declaration in the matching handler or entering @c unexpected()
    *  due to the throw; or after entering @c terminate() for any reason
    *  other than an explicit call to @c terminate().  [Note: This includes
-   *  stack unwinding [15.2].  end note]"
+   *  stack unwinding [15.2].  end note]'
    *
-   *  2:  "When @c uncaught_exception() is true, throwing an %exception can
-   *  result in a call of @c terminate() (15.5.1)."
+   *  2: 'When @c uncaught_exception() is true, throwing an
+   *  %exception can result in a call of @c terminate()
+   *  (15.5.1).'
    */
   bool uncaught_exception() throw() __attribute__ ((__pure__));
 
index 9319a481146fb6e3ce2afaac8b571a5b8f0202e2..2ae375454e0de6e42e7b35f5884342009e84aee2 100644 (file)
@@ -48,8 +48,8 @@ void test01()
 // { dg-error "instantiated from here" "" { target *-*-* } 40 }
 // { dg-error "instantiated from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 546 }
-// { dg-error "declaration of" "" { target *-*-* } 508 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 547 }
+// { dg-error "declaration of" "" { target *-*-* } 509 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }
index 7497767b165434247593b8aa0abbe461a4e4911f..5bf030cabcbd728c3ee846315ce3d0c5cc17c35d 100644 (file)
@@ -48,8 +48,8 @@ void test01()
 // { dg-error "instantiated from here" "" { target *-*-* } 40 }
 // { dg-error "instantiated from here" "" { target *-*-* } 42 }
 
-// { dg-error "invalid use of incomplete type" "" { target *-*-* } 467 }
-// { dg-error "declaration of" "" { target *-*-* } 429 }
+// { dg-error "invalid use of incomplete type" "" { target *-*-* } 468 }
+// { dg-error "declaration of" "" { target *-*-* } 430 }
 
 // { dg-excess-errors "At global scope" }
 // { dg-excess-errors "In instantiation of" }
This page took 0.256436 seconds and 5 git commands to generate.