SysTutorials

Linux Manual Pages › Section 3

stdstricttotallyorderedstdstricttotallyorderedwith(3)

std::StrictTotallyOrdered,std::StrictTotallyOrderedWith - std::StrictTotallyOrdered,std::StrictTotallyOrderedWith

Synopsis

Defined in header<concepts>
    template <class T>
    concept StrictTotallyOrdered =
        std::EqualityComparable<T> &&
    requires(const std::remove_reference_t<T> &a,
             const std::remove_reference_t<T> &b)
{
    (1)(since C++ 20)
            a < b;
    requires std::Boolean<decltype(a < b)>;
    a > b;
    requires std::Boolean<decltype(a > b)>;
    a <= b;
    requires std::Boolean<decltype(a <= b)>;
    a >= b;
    requires std::Boolean<decltype(a >= b)>;
};
template <class T, class U>
concept StrictTotallyOrderedWith =
    std::StrictTotallyOrdered<T> &&
    std::StrictTotallyOrdered<U> &&
    std::CommonReference <
    const std::remove_reference_t<T>
&,
    const std::remove_reference_t<U> & > &&
                                         std::StrictTotallyOrdered<
                                             std::common_reference_t<
                                                 const std::remove_reference_t<T> &,
                                                 const std::remove_reference_t<U> &>> &&
                                             std::EqualityComparableWith<T, U> &&
        (2)(since C++ 20)
            requires(const std::remove_reference_t<T> &t,
                     const std::remove_reference_t<U> &u)
{
    t < u;
    requires std::Boolean<decltype(t < u)>;
    t > u;
    requires std::Boolean<decltype(t > u)>;
    t <= u;
    requires std::Boolean<decltype(t <= u)>;
    t >= u;
    requires std::Boolean<decltype(t >= u)>;
    u < t;
    requires std::Boolean<decltype(u < t)>;
    u > t;
    requires std::Boolean<decltype(u > t)>;
    u <= t;
    requires std::Boolean<decltype(u <= t)>;
    u >= t;
    requires std::Boolean<decltype(u >= t)>;
};
  1. The concept StrictTotallyOrdered<T> specifies that the comparison operators ==,!=,<,>,<=,>= on T yield results consistent with a strict_total_order on T. StrictTotallyOrdered<T> is satisfied only if, given lvalues a, b and c of type const std::remove_reference_t<T>:
  1. The concept StrictTotallyOrderedWith<T, U> specifies that the comparison operators ==,!=,<,>,<=,>= on (possibly mixed) T and U operands yield results consistent with a strict total order. Comparing mixed operands yields results equivalent to comparing the operands converted to their common type. Formally, StrictTotallyOrderedWith<T, U> is satisfied only if, given any lvalue t of type const std::remove_reference_t<T> and any lvalue u of type const std::remove_reference_t<U>, and let C be std::common_reference_t<const std::remove_reference_t<T>&, const std::remove_reference_t<U>&> :