[PATCH] Make __resource_adaptor_imp usable with C++17 memory_resource
Jonathan Wakely
jwakely@redhat.com
Wed Jul 25 17:24:00 GMT 2018
On 24/07/18 14:06 +0100, Jonathan Wakely wrote:
>By making the memory_resource base class a template parameter the
>__resource_adaptor_imp can be used to adapt an allocator into a
>std::pmr::memory_resource instead of experimental::pmr::memory_resource.
>
>No uses for this in the library but somebody might want to do it, and
>it costs us nothing to support.
>
> * include/experimental/memory_resource: Adjust comments and
> whitespace.
> (__resource_adaptor_imp): Add second template parameter for type of
> memory resource base class.
> (memory_resource): Define default constructor, destructor, copy
> constructor and copy assignment operator as defaulted.
>
>Tested powerpc64le-linux, committed to trunk.
>
>commit ce04fa1c00b40a938cc25a264836a2e30149056e
>Author: Jonathan Wakely <jwakely@redhat.com>
>Date: Tue Jul 24 12:24:53 2018 +0100
>
> Make __resource_adaptor_imp usable with C++17 memory_resource
>
> By making the memory_resource base class a template parameter the
> __resource_adaptor_imp can be used to adapt an allocator into a
> std::pmr::memory_resource instead of experimental::pmr::memory_resource.
>
> * include/experimental/memory_resource: Adjust comments and
> whitespace.
> (__resource_adaptor_imp): Add second template parameter for type of
> memory resource base class.
> (memory_resource): Define default constructor, destructor, copy
> constructor and copy assignment operator as defaulted.
>
>diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource
>index 83379d1367a..7ce64457a11 100644
>--- a/libstdc++-v3/include/experimental/memory_resource
>+++ b/libstdc++-v3/include/experimental/memory_resource
>@@ -29,12 +29,12 @@
> #ifndef _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE
> #define _GLIBCXX_EXPERIMENTAL_MEMORY_RESOURCE 1
>
>-#include <memory>
>+#include <memory> // align, uses_allocator, __uses_alloc
>+#include <experimental/utility> // pair, experimental::erased_type
>+#include <atomic> // atomic
> #include <new>
>-#include <atomic>
>-#include <cstddef>
> #include <ext/new_allocator.h>
>-#include <experimental/bits/lfts_config.h>
>+#include <debug/assertions.h>
I should not have removed <cstddef> here, it's needed for
std::max_align_t.
Committed to trunk as obvious.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 858 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20180725/421b2f2a/attachment.bin>
More information about the Libstdc++
mailing list