This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [PATCH] Make __resource_adaptor_imp usable with C++17 memory_resource


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.


commit 5258907ab3e829b75a70872e9d6f627461c84176
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jul 25 18:20:29 2018 +0100

    Add missing header for std::max_align_t
    
            * include/experimental/memory_resource: Include <cstddef> header.

diff --git a/libstdc++-v3/include/experimental/memory_resource b/libstdc++-v3/include/experimental/memory_resource
index 7ce64457a11..61c9ce0a14a 100644
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -32,7 +32,8 @@
 #include <memory>			// align, uses_allocator, __uses_alloc
 #include <experimental/utility>		// pair, experimental::erased_type
 #include <atomic>			// atomic
-#include <new>
+#include <new>				// placement new
+#include <cstddef>			// max_align_t
 #include <ext/new_allocator.h>
 #include <debug/assertions.h>
 

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