[libcxx-commits] [libcxx] [libc++][pair] P2944R3: Constrain `std::pair`'s equality operator (PR #136672)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 23 01:55:49 PDT 2025


================
@@ -447,7 +448,14 @@ pair(_T1, _T2) -> pair<_T1, _T2>;
 
 template <class _T1, class _T2, class _U1, class _U2>
 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool
-operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y) {
+operator==(const pair<_T1, _T2>& __x, const pair<_U1, _U2>& __y)
+#if _LIBCPP_STD_VER >= 26
+  requires requires {
+    { __x.first == __y.first } -> __boolean_testable;
+    { __x.second == __y.second } -> __boolean_testable;
+  }
----------------
philnik777 wrote:

Don't we have the same situation as in #135759? (that `__boolean_testable` might be too strict)

https://github.com/llvm/llvm-project/pull/136672


More information about the libcxx-commits mailing list