tmp/tmp_7b5unzw/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Concept `three_way_comparable` <a id="cmp.concept">[[cmp.concept]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class T, class Cat>
|
| 5 |
+
concept compares-as = // exposition only
|
| 6 |
+
same_as<common_comparison_category_t<T, Cat>, Cat>;
|
| 7 |
+
|
| 8 |
+
template<class T, class U>
|
| 9 |
+
concept partially-ordered-with = // exposition only
|
| 10 |
+
requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) {
|
| 11 |
+
{ t < u } -> boolean-testable;
|
| 12 |
+
{ t > u } -> boolean-testable;
|
| 13 |
+
{ t <= u } -> boolean-testable;
|
| 14 |
+
{ t >= u } -> boolean-testable;
|
| 15 |
+
{ u < t } -> boolean-testable;
|
| 16 |
+
{ u > t } -> boolean-testable;
|
| 17 |
+
{ u <= t } -> boolean-testable;
|
| 18 |
+
{ u >= t } -> boolean-testable;
|
| 19 |
+
};
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
Let `t` and `u` be lvalues of types `const remove_reference_t<T>` and
|
| 23 |
+
`const remove_reference_t<U>`, respectively. `T` and `U` model
|
| 24 |
+
`partially-ordered-with<T, U>` only if:
|
| 25 |
+
|
| 26 |
+
- `t < u`, `t <= u`, `t > u`, `t >= u`, `u < t`, `u <= t`, `u > t`, and
|
| 27 |
+
`u >= t` have the same domain.
|
| 28 |
+
- `bool(t < u) == bool(u > t)` is `true`,
|
| 29 |
+
- `bool(u < t) == bool(t > u)` is `true`,
|
| 30 |
+
- `bool(t <= u) == bool(u >= t)` is `true`, and
|
| 31 |
+
- `bool(u <= t) == bool(t >= u)` is `true`.
|
| 32 |
+
|
| 33 |
+
``` cpp
|
| 34 |
+
template<class T, class Cat = partial_ordering>
|
| 35 |
+
concept three_way_comparable =
|
| 36 |
+
weakly-equality-comparable-with<T, T> &&
|
| 37 |
+
partially-ordered-with<T, T> &&
|
| 38 |
+
requires(const remove_reference_t<T>& a, const remove_reference_t<T>& b) {
|
| 39 |
+
{ a <=> b } -> compares-as<Cat>;
|
| 40 |
+
};
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
Let `a` and `b` be lvalues of type `const remove_reference_t<T>`. `T`
|
| 44 |
+
and `Cat` model `three_way_comparable<T, Cat>` only if:
|
| 45 |
+
|
| 46 |
+
- `(a <=> b == 0) == bool(a == b)` is `true`,
|
| 47 |
+
- `(a <=> b != 0) == bool(a != b)` is `true`,
|
| 48 |
+
- `((a <=> b) <=> 0)` and `(0 <=> (b <=> a))` are equal,
|
| 49 |
+
- `(a <=> b < 0) == bool(a < b)` is `true`,
|
| 50 |
+
- `(a <=> b > 0) == bool(a > b)` is `true`,
|
| 51 |
+
- `(a <=> b <= 0) == bool(a <= b)` is `true`,
|
| 52 |
+
- `(a <=> b >= 0) == bool(a >= b)` is `true`, and
|
| 53 |
+
- if `Cat` is convertible to `strong_ordering`, `T` models
|
| 54 |
+
`totally_ordered` [[concept.totallyordered]].
|
| 55 |
+
|
| 56 |
+
``` cpp
|
| 57 |
+
template<class T, class U, class Cat = partial_ordering>
|
| 58 |
+
concept three_way_comparable_with =
|
| 59 |
+
three_way_comparable<T, Cat> &&
|
| 60 |
+
three_way_comparable<U, Cat> &&
|
| 61 |
+
common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&> &&
|
| 62 |
+
three_way_comparable<
|
| 63 |
+
common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>, Cat> &&
|
| 64 |
+
weakly-equality-comparable-with<T, U> &&
|
| 65 |
+
partially-ordered-with<T, U> &&
|
| 66 |
+
requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) {
|
| 67 |
+
{ t <=> u } -> compares-as<Cat>;
|
| 68 |
+
{ u <=> t } -> compares-as<Cat>;
|
| 69 |
+
};
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Let `t` and `u` be lvalues of types `const remove_reference_t<T>` and
|
| 73 |
+
`const remove_reference_t<U>`, respectively. Let `C` be
|
| 74 |
+
`common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>`.
|
| 75 |
+
`T`, `U`, and `Cat` model `three_way_comparable_with<T, U, Cat>` only
|
| 76 |
+
if:
|
| 77 |
+
|
| 78 |
+
- `t <=> u` and `u <=> t` have the same domain,
|
| 79 |
+
- `((t <=> u) <=> 0)` and `(0 <=> (u <=> t))` are equal,
|
| 80 |
+
- `(t <=> u == 0) == bool(t == u)` is `true`,
|
| 81 |
+
- `(t <=> u != 0) == bool(t != u)` is `true`,
|
| 82 |
+
- `Cat(t <=> u) == Cat(C(t) <=> C(u))` is `true`,
|
| 83 |
+
- `(t <=> u < 0) == bool(t < u)` is `true`,
|
| 84 |
+
- `(t <=> u > 0) == bool(t > u)` is `true`,
|
| 85 |
+
- `(t <=> u <= 0) == bool(t <= u)` is `true`,
|
| 86 |
+
- `(t <=> u >= 0) == bool(t >= u)` is `true`, and
|
| 87 |
+
- if `Cat` is convertible to `strong_ordering`, `T` and `U` model
|
| 88 |
+
`totally_ordered_with<T, U>` [[concept.totallyordered]].
|
| 89 |
+
|