Three‐way comparison operators

Synopses

Declared in <bslstl_deque.h>

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs sets by using the comparison operators of KEY on each element; return the result of that comparison.

template<
    class KEY,
    class COMPARATOR,
    class ALLOCATOR>
BloombergLP::bslalg::SynthThreeWayUtil::Result<KEY>
operator<=>(
    set<KEY, COMPARATOR, ALLOCATOR> const& lhs,
    set<KEY, COMPARATOR, ALLOCATOR> const& rhs);

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs lists by using the comparison operators of VALUE on each element; return the result of that comparison.

Return the three‐way comparison result of the specified lhs and rhs queues by comparing their underlying containers.

template<
    class VALUE,
    three_way_comparable CONTAINER>
compare_three_way_result_t<CONTAINER>
operator<=>(
    queue<VALUE, CONTAINER> const& lhs,
    queue<VALUE, CONTAINER> const& rhs);

Return the three‐way comparison of the specified queues; see the non‐member operator<=> in the bsl namespace.

compare_three_way_result_t<CONTAINER2>
operator<=>(
    queue<VALUE2, CONTAINER2> const&,
    queue<VALUE2, CONTAINER2> const&);

If lhs and rhs are not valueless by exception and hold the same alternative i, return get(lhs) <=> get(rhs) . If lhs and rhs are not valueless by exception and hold the aalternatives i and j respectively, return i<=>j. Return strong_ordering::equal if both variants are valueless by exception. Return strong_ordering::less if lhs is valueless by exception. Return strong_ordering::greater if rhs is valueless by exception.

template<class... t_ALTS>
requires (std::three_way_comparable<t_ALTS> && ...)
constexpr
std::common_comparison_category_t<std::compare_three_way_result_t<t_ALTS>...>
operator<=>(
    variant<t_ALTS...> const& lhs,
    variant<t_ALTS...> const& rhs);

Same as the related overload above for operator<=>.

template<
    class VALUE,
    three_way_comparable CONTAINER>
compare_three_way_result_t<CONTAINER>
operator<=>(
    stack<VALUE, CONTAINER> const& lhs,
    stack<VALUE, CONTAINER> const& rhs);

Same as the related overload above for operator<=>.

compare_three_way_result_t<CONT>
operator<=>(
    stack<VAL, CONT> const&,
    stack<VAL, CONT> const&);

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs containers by using the comparison operators of VALUE_TYPE on each element; return the result of that comparison.

Perform a three‐way comparison of the specified lhs and the specified rhs objects by using the comparison operators of t_LHS and t_RHS; return the result of that comparison. This function can be called in constant expressions only if t_LHS is not allocator‐aware.

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

Perform a three‐way comparison of the specified value and nullopt; return the result of that comparison. This function can be called in constant expressions only if t_TYPE is not allocator‐aware.

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

Perform a three‐way comparison of the specified lhs and the specified rhs objects by using the comparison operators of t_LHS and t_RHS; return the result of that comparison. This function can be called in constant expressions only if t_LHS is not allocator‐aware.

template<
    class t_LHS,
    class t_RHS>
requires (!BloombergLP::bslstl::Optional_DerivedFromOptional<t_RHS>) &&
         three_way_comparable_with<t_LHS, t_RHS>
constexpr
compare_three_way_result_t<t_LHS, t_RHS>
operator<=>(
    bsl::optional<t_LHS> const& lhs,
    t_RHS const& rhs);

Perform a three‐way comparison of the specified lhs and the specified rhs objects by using the comparison operators of t_LHS and t_RHS; return the result of that comparison. This function can be called in constant expressions only if neither t_LHS nor t_RHS is allocator‐aware.

template<
    class t_LHS,
    three_way_comparable_with<t_LHS> t_RHS>
constexpr
compare_three_way_result_t<t_LHS, t_RHS>
operator<=>(
    bsl::optional<t_LHS> const& lhs,
    bsl::optional<t_RHS> const& rhs);

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs multisets by using the comparison operators of KEY on each element; return the result of that comparison.

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs pairs by using the comparison operators of T1 and T2; return the result of that comparison.

template<
    class T1,
    class T2>
constexpr
std::common_comparison_category_t<BloombergLP::bslalg::SynthThreeWayUtil::Result<T1>, BloombergLP::bslalg::SynthThreeWayUtil::Result<T2>>
operator<=>(
    pair<T1, T2> const& lhs,
    pair<T1, T2> const& rhs);

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs maps by using the comparison operators of bsl::pair<const KEY, VALUE> on each element; return the result of that comparison.

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs maps by using the comparison operators of bsl::pair<const KEY, VALUE> on each element; return the result of that comparison.

Perform a three‐way comparison of the specified ptr and null pointer by using the comparison operators of TYPE *; return the result of that comparison.

template<class TYPE>
std::strong_ordering
operator<=>(
    shared_ptr<TYPE> const& ptr,
    nullptr_t) noexcept;

Perform a three‐way comparison of the specified lhs and the specified rhs pointers by using the comparison operators of LHS_TYPE * and RHS_TYPE *; return the result of that comparison.

template<
    class LHS_TYPE,
    class RHS_TYPE>
std::strong_ordering
operator<=>(
    shared_ptr<LHS_TYPE> const& lhs,
    shared_ptr<RHS_TYPE> const& rhs) noexcept;

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs strings by using CHAR_TRAITS::eq on each character; return the result of that comparison.

template<
    class CHAR_TYPE,
    class CHAR_TRAITS,
    class ALLOC1,
    class ALLOC2>
bsl::String_ComparisonCategoryType<CHAR_TRAITS>
operator<=>(
    bsl::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC1> const& lhs,
    std::basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC2> const& rhs) noexcept;

Perform a lexicographic three‐way comparison of the specified lhs string and the specified rhs C‐string by using CHAR_TRAITS::eq on each character; return the result of that comparison.

template<
    class CHAR_TYPE,
    class CHAR_TRAITS,
    class ALLOC>
bsl::String_ComparisonCategoryType<CHAR_TRAITS>
operator<=>(
    basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC> const& lhs,
    CHAR_TYPE const* rhs);

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs strings by using CHAR_TRAITS::eq on each character; return the result of that comparison.

template<
    class CHAR_TYPE,
    class CHAR_TRAITS,
    class ALLOC>
bsl::String_ComparisonCategoryType<CHAR_TRAITS>
operator<=>(
    basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC> const& lhs,
    basic_string<CHAR_TYPE, CHAR_TRAITS, ALLOC> const& rhs) noexcept;

Perform a three‐way comparison of the specified lhs and rhs vectors and return the result of that comparison.

Perform a three‐way comparison of the specified lhs and rhs vectors and return the result of that comparison.

Perform a three‐way comparison of the specified lhs and rhs vectors and return the result of that comparison.

Perform a lexicographic three‐way comparison of the specified lhs and the specified rhs vectors by using the comparison operators of VALUE_TYPE on each element; return the result of that comparison.

Created with MrDocs