[libcxx-commits] [libcxx] 9a6ca67 - [libc++][spaceship] P1614R2: Removed `operator!=` from `functional`

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 12 09:48:54 PDT 2023


Author: Hristo Hristov
Date: 2023-06-12T19:48:42+03:00
New Revision: 9a6ca67397ebe6a05f33dd560b8f0a8969df6219

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

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

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

Reviewed By: #libc, Mordante

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

Added: 
    

Modified: 
    libcxx/docs/Status/SpaceshipProjects.csv
    libcxx/include/__functional/function.h
    libcxx/include/functional

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv
index f0757768380a7..3d02691127c16 100644
--- a/libcxx/docs/Status/SpaceshipProjects.csv
+++ b/libcxx/docs/Status/SpaceshipProjects.csv
@@ -65,7 +65,7 @@ Section,Description,Dependencies,Assignee,Complete
 "| `[functional.syn] <https://wg21.link/functional.syn>`_
 | `[range.cmp] <https://wg21.link/range.cmp>`_
 | `[func.wrap.func] <https://wg21.link/func.wrap.func>`_
-| `[func.wrap.func.nullptr] <https://wg21.link/func.wrap.func.nullptr>`_",| remove ops `function`,None,Unassigned,|Not Started|
+| `[func.wrap.func.nullptr] <https://wg21.link/func.wrap.func.nullptr>`_",| remove ops `function <https://reviews.llvm.org/D152704>`_,None,Hristo Hristov,|Complete|
 | `[meta.unary.prop] <https://wg21.link/meta.unary.prop>`_,| replaced by `issue LWG3354 <https://wg21.link/LWG3354>`_,None,Unassigned,|Nothing To Do|
 | `[meta.trans.other] <https://wg21.link/meta.trans.other>`_,|,None,Unassigned,|Not Started|
 "| `[type.index.overview] <https://wg21.link/type.index.overview>`_

diff  --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index f3abba4536c7f..ae7116b04ef8b 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -1058,8 +1058,10 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
     // deleted overloads close possible hole in the type system
     template<class _R2, class... _ArgTypes2>
       bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
+#if _LIBCPP_STD_VER <= 17
     template<class _R2, class... _ArgTypes2>
       bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
+#endif
 public:
     // function invocation:
     _LIBCPP_HIDE_FROM_ABI _Rp operator()(_ArgTypes...) const;
@@ -1198,6 +1200,8 @@ inline _LIBCPP_INLINE_VISIBILITY
 bool
 operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
 
+#if _LIBCPP_STD_VER <= 17
+
 template <class _Rp, class... _ArgTypes>
 inline _LIBCPP_INLINE_VISIBILITY
 bool
@@ -1213,6 +1217,8 @@ inline _LIBCPP_INLINE_VISIBILITY
 bool
 operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
 
+#endif // _LIBCPP_STD_VER <= 17
+
 template <class _Rp, class... _ArgTypes>
 inline _LIBCPP_INLINE_VISIBILITY
 void

diff  --git a/libcxx/include/functional b/libcxx/include/functional
index 63af88750491f..1cae37e0e784b 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -456,13 +456,13 @@ template <class R, class ... ArgTypes>
   bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
 
 template <class R, class ... ArgTypes>
-  bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+  bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept; // removed in C++20
 
 template <class R, class ... ArgTypes>
-  bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
+  bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept; // removed in C++20
 
 template <class  R, class ... ArgTypes>
-  bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+  bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept; // removed in C++20
 
 // specialized algorithms:
 template <class  R, class ... ArgTypes>


        


More information about the libcxx-commits mailing list