17 Concepts library [concepts]

17.5 Comparison concepts [concepts.compare]

17.5.4 Concept StrictTotallyOrdered [concept.stricttotallyordered]

template<class T> concept StrictTotallyOrdered = EqualityComparable<T> && requires(const remove_reference_t<T>& a, const remove_reference_t<T>& b) { a < b; requires Boolean<decltype(a < b)>; a > b; requires Boolean<decltype(a > b)>; a <= b; requires Boolean<decltype(a <= b)>; a >= b; requires Boolean<decltype(a >= b)>; };
Let a, b, and c be lvalues of type const 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 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; requires Boolean<decltype(t < u)>; t > u; requires Boolean<decltype(t > u)>; t <= u; requires Boolean<decltype(t <= u)>; t >= u; requires Boolean<decltype(t >= u)>; u < t; requires Boolean<decltype(u < t)>; u > t; requires Boolean<decltype(u > t)>; u <= t; requires Boolean<decltype(u <= t)>; u >= t; requires Boolean<decltype(u >= t)>; };
Let t be an lvalue of type const remove_­reference_­t<T>, u be an lvalue of type const 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)).