[libcxx-commits] [libcxx] [libc++][pair] P2944R3: Constrain `std::pair`'s equality operator (PR #136672)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Apr 23 03:25:04 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;
+ }
----------------
Zingam wrote:
As @frederick-vs-ja pointed out these are described as `__boolean_testable` in the standard so I prefer to keep them as such for consistency with the Standard but I'll update the `reference_wrapper` with the proposed concept in https://github.com/llvm/llvm-project/pull/135759 later.
https://github.com/llvm/llvm-project/pull/136672
More information about the libcxx-commits
mailing list