[patch] Improving shared_ptr for C++0x
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Dec 9 19:13:00 GMT 2007
Hi all,
sorry for the slow turnaround on this patch, thanks to work,
travelling, a dead modem and a new Mario game on the Wii I've not been
at my PC a lot :)
As proposed last month, this patch creates new TR1- and C++0x-specific
headers for the _Sp_counted_* classes. The _Sp_counted_base abstract
base is in a new common tr1_impl file.
Not many changes since the last patch apart from splitting the code
across several headers and restoring the TR1 _Sp_counted_base_impl
class. I replaced uses of __gnu_cxx::new_allocator with
std::allocator. I also took the liberty of making __static_cast_tag
etc. TR1-only and implementing static_pointer_cast<> using the alias
ctor for C++0x. This adds some #if checks but removes non-standard
types and constructors from namespace std and std::shared_ptr.
I haven't done so, but we should really duplicate some of the
shared_ptr testsuite to test in both TR1 and C++0x mode because the
implementations are now different in parts. As a quick hack I
duplicated all the relevant tests and changed them to use
std::shared_ptr instead of tr1::shared_ptr, so I can confirm that both
implementations pass all the tests, but you can't tell that just from
the tests in subversion. We should decide the best way to do this
without too much duplication.
OK for mainline?
2007-12-09 Jonathan Wakely <...>
* include/tr1_impl/boost_shared_ptr.h: Add support for allocators,
aliasing, make_shared and rvalue-references. Move __shared_count
and _Sp_counted_* classes to new headers.
* include/tr1_impl/boost_sp_counted_base.h: New.
* include/bits/boost_sp_shared_count.h: New.
* include/tr1/boost_sp_shared_count.h: New.
* include/std/memory, include/tr1/memory: Include new headers.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/alias.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/alloc.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/cons/move.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/assign/move.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/creation/alloc.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/creation/make.cc: New.
* testsuite/tr1/2_general_utilities/shared_ptr/modifiers/
reset_alloc.cc: New.
* docs/html/20_util/shared_ptr.html: New.
* docs/html/20_util/shared_ptr.html: New.
* docs/html/17_intro/c++0x_status.html: Update shared_ptr status.
Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shared_ptr.patch
Type: text/x-patch
Size: 95338 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20071209/2ac99872/attachment.bin>
More information about the Libstdc++
mailing list