[v3] finish allocator support in <future> and std::shared_ptr

Jonathan Wakely jwakely.gcc@gmail.com
Tue Nov 8 16:55:00 GMT 2011


This is the final version of a patch I've had hanging around for about
6 months, it makes futures and shared_ptr use allocator_traits so they
work with minimal C++11 allocators, such as the testsuite's
SimpleAllocator, and implement the proposed resolution of LWG 2070
(which is still in Open state, but only while wording is tweaked.)  I
also added the 'final' virt-specifier to a few polymorphic classes.

        * include/bits/shared_ptr_base.h (_Sp_counted_ptr): Make 'final'.
        (_Sp_counted_deleter): Make 'final'. Use allocator_traits.
        (_Sp_counted_ptr_inplace): Make 'final'. Use allocator_traits.
        Derive from _Sp_counted_ptr instead of _Sp_counted_deleter to use EBO
        for the allocator.
        (__shared_count, __shared_ptr): Use allocator_traits.
        * include/std/future (__future_base::_Result_alloc): Make 'final'. Use
        allocator traits.
        (__future_base::_Task_state): Make 'final'.
        (__future_base::_Deferred_state): Likewise.
        (__future_base::_Async_state): Likewise.
        * testsuite/20_util/shared_ptr/cons/alloc_min.cc: New.
        * testsuite/20_util/shared_ptr/creation/alloc_min.cc: New.
        * testsuite/20_util/shared_ptr/creation/private.cc: New.
        * testsuite/20_util/shared_ptr/cons/43820_neg.cc: Adjust line numbers.
        * testsuite/30_threads/packaged_task/cons/alloc_min.cc: New.
        * testsuite/30_threads/promise/cons/alloc_min.cc: New.

tested x86_64-linux, committed to trunk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_min.patch
Type: text/x-patch
Size: 20786 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20111108/8d4a9c51/attachment.bin>


More information about the Libstdc++ mailing list