Files
2025-10-25 03:02:53 +03:00

2.4 KiB

[expected.object.eq]

22 General utilities library [utilities]

22.8 Expected objects [expected]

22.8.6 Class template expected [expected.expected]

22.8.6.8 Equality operators [expected.object.eq]

🔗

template<class T2, class E2> requires (!is_void_v<T2>) friend constexpr bool operator==(const expected& x, const expected<T2, E2>& y);

1

#

Constraints: The expressions *x == *y and x.error() == y.error() are well-formed and their results are convertible to bool.

2

#

Returns: If x.has_value() does not equal y.has_value(), false; otherwise if x.has_value() is true, *x == *y; otherwise x.error() == y.error().

🔗

template<class T2> friend constexpr bool operator==(const expected& x, const T2& v);

3

#

Constraints: T2 is not a specialization of expected.

The expression *x == v is well-formed and its result is convertible to bool.

[Note 1:

T need not be Cpp17EqualityComparable.

— end note]

4

#

Returns: x.has_value() && static_cast(*x == v).

🔗

template<class E2> friend constexpr bool operator==(const expected& x, const unexpected<E2>& e);

5

#

Constraints: The expression x.error() == e.error() is well-formed and its result is convertible to bool.

6

#

Returns: !x.has_value() && static_cast(x.error() == e.error()).