On 13/11/15 11:09 +0000, Jonathan Wakely wrote:
This is the other piece of work done by Fan You for the Google Summer
of Code (and mentored by Tim).
This implements experimental::shared_ptr from the Library Fundamentals
TS, which differs from std::shared_ptr by supporting arrays, i.e.
shared_ptr<int[]> and shared_ptr<int[2]> behave correctly, using
delete[] to free the managed memory, and providing operator[] instead
of operator* and operator->.
I made a few changes to Fan You's patch:
- moved __libfund_v1 tag type and new partial specializations to
<experimental/memory>, so all changes are in the experimental dir.
- added a second template parameter to the tag type to distinguish
arrays from non-arrays, so we can have two partial specializations,
__shared_ptr<__libfund_v1<T, true>> and __shared_ptr<__libfund_v1<T,
false>>, with slightly different interfaces.
- added std::hash specialization.
- used remove_extent_t, enable_if_t etc alias templates.
- removed the _Weak_friend helper class.
- fixed some tests that used operator-> on shared_ptr<T[]>.
Thanks very much to Fan You, and to TIm Shen and Google.
Tested powerpc64le-linux, committed to trunk.
Oops, I made a small error in the doxygen @file comment, fixed with
this patch. Committed to trunk.
commit 5fb8a8b7401e0374d34574db0398639b84c36b6e
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Fri Nov 13 11:16:51 2015 +0000
* include/experimental/bits/shared_ptr.h: Tweak comments.
diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h
index feba7d7..413652d 100644
--- a/libstdc++-v3/include/experimental/bits/shared_ptr.h
+++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h
@@ -24,7 +24,7 @@
/** @file experimental/bits/shared_ptr.h
* This is an internal header file, included by other library headers.
- * Do not attempt to use it directly. @headername{memory}
+ * Do not attempt to use it directly. @headername{experimental/memory}
*/
#ifndef _GLIBCXX_EXPERIMENTAL_SHARED_PTR_H
@@ -57,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/*
* The specification of std::experimental::shared_ptr is slightly different
- * to std::shared_ptr (specifically in terms of pointer "compatibility") so
+ * to std::shared_ptr (specifically in terms of "compatible" pointers) so
* to implement std::experimental::shared_ptr without too much duplication
* we make it derive from a partial specialization of std::__shared_ptr
* using a special tag type, __libfund_v1.