Three-way comparison operators
Declared in <beman/optional/optional.hpp>
Compares two nullopt_t objects.
constexpr
std::strong_ordering
operator<=>(
nullopt_t lhs,
nullopt_t rhs) noexcept;
» more...
Three-way comparison of two optionals.
template<
typename T,
std::three_way_comparable_with<T> U>
constexpr
std::compare_three_way_result_t<T, U>
operator<=>(
optional<T> const& lhs,
optional<U> const& rhs);
» more...
Three-way comparison of an optional against nullopt.
template<class T>
constexpr
std::strong_ordering
operator<=>(
optional<T> const& lhs,
nullopt_t rhs) noexcept;
» more...
Three-way comparison of an optional against a value.
template<
typename T,
typename U>
requires (!is_derived_from_optional<U>) && std::three_way_comparable_with<T, U>
constexpr
std::compare_three_way_result_t<T, U>
operator<=>(
optional<T> const& x,
U const& v);
» more...
std::strong_ordering::equivalent, since all nullopt_t objects compare equal.equivalent if lhs is disengaged, otherwise greater.v.| Name | Description |
|---|---|
| lhs | The left-hand nullopt_t object. |
| rhs | The right-hand nullopt_t object. |
| x | The optional operand. |
| v | The value operand. |