7 Concepts library [concepts.lib]

7.4 Comparison concepts [concepts.lib.compare]

7.4.4 Concept StrictTotallyOrdered [concepts.lib.compare.stricttotallyordered]

template <class T> concept bool StrictTotallyOrdered = EqualityComparable<T> && requires(const remove_reference_t<T>& a, const remove_reference_t<T>& b) { { a < b } -> Boolean&&; { a > b } -> Boolean&&; { a <= b } -> Boolean&&; { a >= b } -> Boolean&&; };

Let a, b, and c be const lvalues of type remove_reference_t<T>. StrictTotallyOrdered<T> is satisfied only if

  • Exactly one of bool(a < b), bool(a > b), or bool(a == b) is true.

  • If bool(a < b) and bool(b < c), then bool(a < c).

  • bool(a > b) == bool(b < a).

  • bool(a <= b) == !bool(b < a).

  • bool(a >= b) == !bool(a < b).

template <class T, class U> concept bool StrictTotallyOrderedWith = StrictTotallyOrdered<T> && StrictTotallyOrdered<U> && CommonReference< const remove_reference_t<T>&, const remove_reference_t<U>&> && StrictTotallyOrdered< common_reference_t< const remove_reference_t<T>&, const remove_reference_t<U>&>> && EqualityComparableWith<T, U> && requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) { { t < u } -> Boolean&&; { t > u } -> Boolean&&; { t <= u } -> Boolean&&; { t >= u } -> Boolean&&; { u < t } -> Boolean&&; { u > t } -> Boolean&&; { u <= t } -> Boolean&&; { u >= t } -> Boolean&&; };

Let t be a const lvalue of type remove_reference_t<T>, u be a const lvalue of type remove_reference_t<U>, and C be:

common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>

StrictTotallyOrderedWith<T, U> is satisfied only if

  • bool(t < u) == bool(C(t) < C(u)).

  • bool(t > u) == bool(C(t) > C(u)).

  • bool(t <= u) == bool(C(t) <= C(u)).

  • bool(t >= u) == bool(C(t) >= C(u)).

  • bool(u < t) == bool(C(u) < C(t)).

  • bool(u > t) == bool(C(u) > C(t)).

  • bool(u <= t) == bool(C(u) <= C(t)).

  • bool(u >= t) == bool(C(u) >= C(t)).