Return the three‐way comparison result of lhs and rhs.

Synopsis

Declared in <bslstl_variant.h>

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);

Description

If lhs and rhs are not valueless by exception and hold the same alternative i, return get<INDEX>(lhs) <=> get<INDEX>(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.

Return Value

the three‐way comparison result of lhs and rhs

Parameters

Name

Description

lhs

variant to compare

rhs

variant to compare

Created with MrDocs