PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
authorJonathan Wakely <jwakely@redhat.com>
Thu, 21 Jun 2018 14:01:11 +0000 (15:01 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 21 Jun 2018 14:01:11 +0000 (15:01 +0100)
commit7956c508ddf36901d06bdb3f5a1ae099ee656924
tree286e04e81c5b4bb551b3135eb3d9b675e6cda6dc
parent67b3b8feb3e6a4d2bb94a66498864eef5d5b5963
PR libstdc++/70940 make pmr::resource_adaptor return aligned memory

PR libstdc++/70940
* include/experimental/memory_resource (__resource_adaptor_common):
New base class.
(__resource_adaptor_common::_AlignMgr): Helper for obtaining aligned
pointer from unaligned, and vice versa.
(__resource_adaptor_imp::do_allocate): Use _AlignMgr to adjust
allocated pointer to meet alignment request.
(__resource_adaptor_imp::do_deallocate): Use _AlignMgr to retrieve
original pointer for deallocation.
(__resource_adaptor_imp::do_is_equal): Reformat.
(__resource_adaptor_imp::_S_aligned_size): Remove.
(__resource_adaptor_imp::_S_supported): Remove.
(new_delete_resource): Use __gnu_cxx::new_allocator.
* testsuite/experimental/memory_resource/resource_adaptor.cc: Test
extended alignments and use debug_allocator to check for matching
allocate/deallocate pairs.

From-SVN: r261849
libstdc++-v3/ChangeLog
libstdc++-v3/include/experimental/memory_resource
libstdc++-v3/testsuite/experimental/memory_resource/resource_adaptor.cc