From Jason Turner

[concept.totallyordered]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpu2jidxye/{from.md → to.md} +48 -0
tmp/tmpu2jidxye/{from.md → to.md} RENAMED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Concept <a id="concept.totallyordered">[[concept.totallyordered]]</a>
2
+
3
+ ``` cpp
4
+ template<class T>
5
+ concept totally_ordered =
6
+ equality_comparable<T> && partially-ordered-with<T, T>;
7
+ ```
8
+
9
+ Given a type `T`, let `a`, `b`, and `c` be lvalues of type
10
+ `const remove_reference_t<T>`. `T` models `totally_ordered` only if
11
+
12
+ - Exactly one of `bool(a < b)`, `bool(a > b)`, or `bool(a == b)` is
13
+ `true`.
14
+ - If `bool(a < b)` and `bool(b < c)`, then `bool(a < c)`.
15
+ - `bool(a <= b) == !bool(b < a)`.
16
+ - `bool(a >= b) == !bool(a < b)`.
17
+
18
+ ``` cpp
19
+ template<class T, class U>
20
+ concept totally_ordered_with =
21
+ totally_ordered<T> && totally_ordered<U> &&
22
+ equality_comparable_with<T, U> &&
23
+ totally_ordered<
24
+ common_reference_t<
25
+ const remove_reference_t<T>&,
26
+ const remove_reference_t<U>&>> &&
27
+ partially-ordered-with<T, U>;
28
+ ```
29
+
30
+ Given types `T` and `U`, let `t` be an lvalue of type
31
+ `const remove_reference_t<T>`, `u` be an lvalue of type
32
+ `const remove_reference_t<U>`, and `C` be:
33
+
34
+ ``` cpp
35
+ common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>
36
+ ```
37
+
38
+ `T` and `U` model `totally_ordered_with<T, U>` only if
39
+
40
+ - `bool(t < u) == bool(C(t) < C(u)).`
41
+ - `bool(t > u) == bool(C(t) > C(u)).`
42
+ - `bool(t <= u) == bool(C(t) <= C(u)).`
43
+ - `bool(t >= u) == bool(C(t) >= C(u)).`
44
+ - `bool(u < t) == bool(C(u) < C(t)).`
45
+ - `bool(u > t) == bool(C(u) > C(t)).`
46
+ - `bool(u <= t) == bool(C(u) <= C(t)).`
47
+ - `bool(u >= t) == bool(C(u) >= C(t)).`
48
+