[libcxx-commits] [libcxx] [libc++] Implement P3379R0 Constrain `std::expected` equality operators (PR #135759)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 21 23:39:59 PDT 2025
================
@@ -1139,8 +1140,12 @@ class expected : private __expected_base<_Tp, _Err> {
// [expected.object.eq], equality operators
template <class _T2, class _E2>
- requires(!is_void_v<_T2>)
- _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y) {
+ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const expected& __x, const expected<_T2, _E2>& __y)
+ requires(!is_void_v<_T2>) && requires {
+ { *__x == *__y } -> __boolean_testable;
----------------
H-G-Hristov wrote:
@frederick-vs-ja I think I can update reference_wrapper soon but I'll use boolean testable for pair as the standard tells. As I don't feel there is a consensus on backporting the constraints I won't apply them as DR for now. It can be done later. WDYT?
https://github.com/llvm/llvm-project/pull/135759
More information about the libcxx-commits
mailing list