[libcxx-commits] [libcxx] 6c34aab - [libc++][spaceship] P1614R2: Removed ops from `memory_resource`, `polymorphic_allocator`

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 11 09:49:41 PDT 2023


Author: Hristo Hristov
Date: 2023-06-11T19:49:35+03:00
New Revision: 6c34aab3ff55b7ea4c6bb88544063ef0854d1a49

URL: https://github.com/llvm/llvm-project/commit/6c34aab3ff55b7ea4c6bb88544063ef0854d1a49
DIFF: https://github.com/llvm/llvm-project/commit/6c34aab3ff55b7ea4c6bb88544063ef0854d1a49.diff

LOG: [libc++][spaceship] P1614R2: Removed ops from `memory_resource`, `polymorphic_allocator`

Implements parts of P1614R2
- Removed ops from `memory_resource`
- Removed ops from `polymorphic_allocator`

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D152629

Added: 
    

Modified: 
    libcxx/docs/Status/SpaceshipProjects.csv
    libcxx/include/__memory_resource/memory_resource.h
    libcxx/include/__memory_resource/polymorphic_allocator.h
    libcxx/include/memory_resource

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv
index c488e9a2a3554..97c7d4e3273ad 100644
--- a/libcxx/docs/Status/SpaceshipProjects.csv
+++ b/libcxx/docs/Status/SpaceshipProjects.csv
@@ -55,9 +55,11 @@ Section,Description,Dependencies,Assignee,Complete
 | `[allocator.globals] <https://wg21.link/allocator.globals>`_,| remove ops `allocator <https://reviews.llvm.org/D152612>`_,None,Hristo Hristov,|In Progress|
 | `[unique.ptr.special] <https://wg21.link/unique.ptr.special>`_,| `unique_ptr <https://reviews.llvm.org/D130838>`_,[comparisons.three.way],Adrian Vogelsgesang,|Complete|
 | `[util.smartptr.shared.cmp] <https://wg21.link/util.smartptr.shared.cmp>`_,| `shared_ptr <https://reviews.llvm.org/D130852>`_,[comparisons.three.way],Adrian Vogelsgesang,|Complete|
-| `[mem.res.syn] <https://wg21.link/mem.res.syn>`_,|,None,Unassigned,|Not Started|
-| `[mem.res.eq] <https://wg21.link/mem.res.eq>`_,| remove ops `memory_resource`,None,Unassigned,|Not Started|
-| `[mem.poly.allocator.eq] <https://wg21.link/mem.poly.allocator.eq>`_,| remove ops `polymorphic_allocator`,None,Unassigned,|Not Started|
+"| `[mem.res.syn] <https://wg21.link/mem.res.syn>`_
+| `[mem.res.eq] <https://wg21.link/mem.res.eq>`_
+| `[mem.poly.allocator.eq] <https://wg21.link/mem.poly.allocator.eq>`_","|
+| remove ops `memory_resource <https://reviews.llvm.org/D152629>`_
+| remove ops `polymorphic_allocator <https://reviews.llvm.org/D152629>`_",None,Hristo Hristov,|Complete|
 "| `[allocator.adaptor.syn] <https://wg21.link/allocator.adaptor.syn>`_
 | `[scoped.adaptor.operators] <https://wg21.link/scoped.adaptor.operators>`_",| remove ops `scoped_allocator_adaptor`,None,Unassigned,|Not Started|
 "| `[functional.syn] <https://wg21.link/functional.syn>`_

diff  --git a/libcxx/include/__memory_resource/memory_resource.h b/libcxx/include/__memory_resource/memory_resource.h
index 4f0e4e48eef0c..7753376d0c49a 100644
--- a/libcxx/include/__memory_resource/memory_resource.h
+++ b/libcxx/include/__memory_resource/memory_resource.h
@@ -55,10 +55,14 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator==(const memory_resource& __lhs, const
   return &__lhs == &__rhs || __lhs.is_equal(__rhs);
 }
 
+#  if _LIBCPP_STD_VER <= 17
+
 inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept {
   return !(__lhs == __rhs);
 }
 
+#  endif
+
 // [mem.res.global]
 
 [[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* get_default_resource() noexcept;

diff  --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h
index f36e2c5af2665..57558f0d3d6cf 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -207,12 +207,16 @@ operator==(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<
   return *__lhs.resource() == *__rhs.resource();
 }
 
+#  if _LIBCPP_STD_VER <= 17
+
 template <class _Tp, class _Up>
 inline _LIBCPP_HIDE_FROM_ABI bool
 operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept {
   return !(__lhs == __rhs);
 }
 
+#  endif
+
 } // namespace pmr
 
 _LIBCPP_END_NAMESPACE_STD

diff  --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource
index 4b393433696f8..276e08f23fa12 100644
--- a/libcxx/include/memory_resource
+++ b/libcxx/include/memory_resource
@@ -22,7 +22,7 @@ namespace std::pmr {
   bool operator==(const memory_resource& a,
                   const memory_resource& b) noexcept;
   bool operator!=(const memory_resource& a,
-                  const memory_resource& b) noexcept;
+                  const memory_resource& b) noexcept;           // removed in C++20
 
   template <class Tp> class polymorphic_allocator;
 
@@ -31,7 +31,7 @@ namespace std::pmr {
                   const polymorphic_allocator<T2>& b) noexcept;
   template <class T1, class T2>
   bool operator!=(const polymorphic_allocator<T1>& a,
-                  const polymorphic_allocator<T2>& b) noexcept;
+                  const polymorphic_allocator<T2>& b) noexcept; // removed in C++20
 
   // Global memory resources
   memory_resource* set_default_resource(memory_resource* r) noexcept;


        


More information about the libcxx-commits mailing list