This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] GSoC: Implement std::experimental::shared_ptr


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.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]