Three‐way comparison operators

Synopses

Declared in <bdlb_nullablevalue.h>

Return a three‐way comparison of the specified lhs and rhs.

template<
    class LHS_TYPE,
    bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
constexpr
std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
operator<=>(
    NullableValue<LHS_TYPE> const& lhs,
    NullableValue<RHS_TYPE> const& rhs);

Perform a three‐way comparison of the specified nullable objects.

template<
    class LHS_TYPE,
    bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
constexpr
std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
operator<=>(
    NullableValue<LHS_TYPE> const& lhs,
    bsl::optional<RHS_TYPE> const& rhs);

Perform a three‐way comparison of the specified nullable objects.

template<
    class LHS_TYPE,
    bsl::three_way_comparable_with<LHS_TYPE> RHS_TYPE>
constexpr
std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
operator<=>(
    NullableValue<LHS_TYPE> const& lhs,
    std::optional<RHS_TYPE> const& rhs);

Perform a three‐way comparison of the specified nullable object and value.

template<
    class LHS_TYPE,
    class RHS_TYPE>
requires (!bdlb::NullableValue_DerivedFromOptional<RHS_TYPE>) &&
              bsl::three_way_comparable_with<LHS_TYPE, RHS_TYPE>
constexpr
std::compare_three_way_result_t<LHS_TYPE, RHS_TYPE>
operator<=>(
    NullableValue<LHS_TYPE> const& lhs,
    RHS_TYPE const& rhs);

Perform a three‐way comparison of the specified value and one of type bsl::nullopt_t; return the result of that comparison.

template<class TYPE>
constexpr
std::strong_ordering
operator<=>(
    NullableValue<TYPE> const& value,
    bsl::nullopt_t const& nullopt) noexcept;

Return Value

the result of the three‐way comparison

Parameters

Name

Description

lhs

left‐hand operand

rhs

right‐hand operand

value

nullable object to compare

nullopt

disengaged‐optional tag

Created with MrDocs