Documenting on some C++20 features, i crossed some named Functions and Operators like the following under <compare>
header :
constexpr bool is_eq (partial_ordering cmp) noexcept { return cmp == 0; }
constexpr bool is_neq (partial_ordering cmp) noexcept { return cmp != 0; }
constexpr bool is_lt (partial_ordering cmp) noexcept { return cmp < 0; }
constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; }
constexpr bool is_gt (partial_ordering cmp) noexcept { return cmp > 0; }
constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; }
Also under <utility>
:
template< class T, class U >
constexpr bool cmp_greater_equal( T t, U u ) noexcept
{
return !cmp_less(u, t);
}
template< class T, class U >
constexpr bool cmp_less_equal( T t, U u ) noexcept
{
return !cmp_greater(t, u);
}
What should we know about the difference between custom comparator (or simple comparators) and these functions ? and what's special about them ?