std::strict_weak_order
From cppreference.com
| Defined in header <concepts>
|
||
template< class R, class T, class U > concept strict_weak_order = std::relation<R, T, U>; |
(since C++20) | |
The concept strict_weak_order<R, T, U> specifies that the relation R imposes a strict weak ordering on its arguments.
Semantic requirements
A relation r is a strict weak ordering if
- it is irreflexive: for all
x,r(x, x)isfalse; - it is transitive: for all
a,bandc, ifr(a, b)andr(b, c)are bothtruethenr(a, c)istrue; - let
e(a, b)be!r(a, b) && !r(b, a), theneis transitive:e(a, b) && e(b, c)impliese(a, c).
Under these conditions, it can be shown that e is an equivalence relation, and r induces a strict total ordering on the equivalence classes determined by e.
Notes
The distinction between relation and strict_weak_order is purely semantic.
References
- C++23 standard (ISO/IEC 14882:2024):
- 18.7.7 Concept
strict_weak_order[concept.strictweakorder]
- 18.7.7 Concept
- C++20 standard (ISO/IEC 14882:2020):
- 18.7.7 Concept
strict_weak_order[concept.strictweakorder]
- 18.7.7 Concept