# 18 Concepts library [concepts]

## 18.5 Comparison concepts [concepts.compare]

### 18.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 } -> Boolean; { a > b } -> Boolean; { a <= b } -> Boolean; { a >= b } -> Boolean; }; ```
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 } -> 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 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)).