22 General utilities library [utilities]

22.5 Optional objects [optional]

22.5.9 Comparison with T [optional.comp.with.t]

template<class T, class U> constexpr bool operator==(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x == v is well-formed and its result is convertible to bool.
[Note 1:  — end note]
Effects: Equivalent to: if (x.has_value()) return *x == v; return false;
template<class T, class U> constexpr bool operator==(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v == *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v == *x; return false;
template<class T, class U> constexpr bool operator!=(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x != v is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return *x != v; return true;
template<class T, class U> constexpr bool operator!=(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v != *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v != *x; return true;
template<class T, class U> constexpr bool operator<(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x < v is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return *x < v; return true;
template<class T, class U> constexpr bool operator<(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v < *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v < *x; return false;
template<class T, class U> constexpr bool operator>(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x > v is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return *x > v; return false;
template<class T, class U> constexpr bool operator>(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v > *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v > *x; return true;
template<class T, class U> constexpr bool operator<=(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x <= v is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return *x <= v; return true;
template<class T, class U> constexpr bool operator<=(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v <= *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v <= *x; return false;
template<class T, class U> constexpr bool operator>=(const optional<T>& x, const U& v);
Constraints: U is not a specialization of optional.
The expression *x >= v is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return *x >= v; return false;
template<class T, class U> constexpr bool operator>=(const T& v, const optional<U>& x);
Constraints: T is not a specialization of optional.
The expression v >= *x is well-formed and its result is convertible to bool.
Effects: Equivalent to: if (x.has_value()) return v >= *x; return true;
template<class T, class U> requires (!is-derived-from-optional<U>) && three_way_comparable_with<T, U> constexpr compare_three_way_result_t<T, U> operator<=>(const optional<T>& x, const U& v);
Effects: Equivalent to: return x.has_value() ? *x <=> v : strong_ordering​::​less;