[libcxx-commits] [libcxx] d1ef99f - [libc++][spaceship] P1614R2: Removed global `operator!=` from `allocator`

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jun 11 23:42:03 PDT 2023


Author: Hristo Hristov
Date: 2023-06-12T09:41:56+03:00
New Revision: d1ef99fe1ce3e2996c317600a1398933b9078260

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

LOG: [libc++][spaceship] P1614R2: Removed global `operator!=` from `allocator`

Implements parts of P1614R2:
- Removed global `operator!=` from `allocator`

Reviewed By: #libc, Mordante

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

Added: 
    

Modified: 
    libcxx/docs/Status/SpaceshipProjects.csv
    libcxx/include/__memory/allocator.h
    libcxx/include/memory

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv
index b8eaa76af1a51..f0757768380a7 100644
--- a/libcxx/docs/Status/SpaceshipProjects.csv
+++ b/libcxx/docs/Status/SpaceshipProjects.csv
@@ -52,7 +52,7 @@ Section,Description,Dependencies,Assignee,Complete
 "| `[template.bitset] <https://wg21.link/template.bitset>`_
 | `[bitset.members] <https://wg21.link/bitset.members>`_","| remove ops `bitset <https://reviews.llvm.org/D152611>`_",None,Hristo Hristov,|Complete|
 | `[memory.syn] <https://wg21.link/memory.syn>`_,|,None,Unassigned,|Not Started|
-| `[allocator.globals] <https://wg21.link/allocator.globals>`_,| remove ops `allocator <https://reviews.llvm.org/D152612>`_,None,Hristo Hristov,|In Progress|
+| `[allocator.globals] <https://wg21.link/allocator.globals>`_,| remove ops `allocator <https://reviews.llvm.org/D152612>`_,None,Hristo Hristov,|Complete|
 | `[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>`_

diff  --git a/libcxx/include/__memory/allocator.h b/libcxx/include/__memory/allocator.h
index badfea05e2ebd..47e1ef926a4af 100644
--- a/libcxx/include/__memory/allocator.h
+++ b/libcxx/include/__memory/allocator.h
@@ -262,10 +262,14 @@ template <class _Tp, class _Up>
 inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;}
 
+#if _LIBCPP_STD_VER <= 17
+
 template <class _Tp, class _Up>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
+inline _LIBCPP_INLINE_VISIBILITY
 bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
 
+#endif
+
 _LIBCPP_END_NAMESPACE_STD
 
 #endif // _LIBCPP___MEMORY_ALLOCATOR_H

diff  --git a/libcxx/include/memory b/libcxx/include/memory
index 39468847961e9..cd6bcc7eaa35d 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -160,7 +160,7 @@ template <class T, class U>
 bool operator==(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20
 
 template <class T, class U>
-bool operator!=(const allocator<T>&, const allocator<U>&) noexcept; // constexpr in C++20
+bool operator!=(const allocator<T>&, const allocator<U>&) noexcept; // removed in C++20
 
 template <class OutputIterator, class T>
 class raw_storage_iterator // deprecated in C++17, removed in C++20


        


More information about the libcxx-commits mailing list