tmp/tmpeqy98l8m/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Concept <a id="concept.equalitycomparable">[[concept.equalitycomparable]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class T, class U>
|
| 5 |
+
concept weakly-equality-comparable-with = // exposition only
|
| 6 |
+
requires(const remove_reference_t<T>& t,
|
| 7 |
+
const remove_reference_t<U>& u) {
|
| 8 |
+
{ t == u } -> boolean-testable;
|
| 9 |
+
{ t != u } -> boolean-testable;
|
| 10 |
+
{ u == t } -> boolean-testable;
|
| 11 |
+
{ u != t } -> boolean-testable;
|
| 12 |
+
};
|
| 13 |
+
```
|
| 14 |
+
|
| 15 |
+
Given types `T` and `U`, let `t` and `u` be lvalues of types
|
| 16 |
+
`const remove_reference_t<T>` and `const remove_reference_t<U>`
|
| 17 |
+
respectively. `T` and `U` model
|
| 18 |
+
*`weakly-equality-comparable-with`*`<T, U>` only if
|
| 19 |
+
|
| 20 |
+
- `t == u`, `u == t`, `t != u`, and `u != t` have the same domain.
|
| 21 |
+
- `bool(u == t) == bool(t == u)`.
|
| 22 |
+
- `bool(t != u) == !bool(t == u)`.
|
| 23 |
+
- `bool(u != t) == bool(t != u)`.
|
| 24 |
+
|
| 25 |
+
``` cpp
|
| 26 |
+
template<class T>
|
| 27 |
+
concept equality_comparable = weakly-equality-comparable-with<T, T>;
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
Let `a` and `b` be objects of type `T`. `T` models `equality_comparable`
|
| 31 |
+
only if `bool(a == b)` is `true` when `a` is equal to `b`
|
| 32 |
+
[[concepts.equality]], and `false` otherwise.
|
| 33 |
+
|
| 34 |
+
[*Note 1*: The requirement that the expression `a == b` is
|
| 35 |
+
equality-preserving implies that `==` is transitive and
|
| 36 |
+
symmetric. — *end note*]
|
| 37 |
+
|
| 38 |
+
``` cpp
|
| 39 |
+
template<class T, class U>
|
| 40 |
+
concept equality_comparable_with =
|
| 41 |
+
equality_comparable<T> && equality_comparable<U> &&
|
| 42 |
+
common_reference_with<const remove_reference_t<T>&, const remove_reference_t<U>&> &&
|
| 43 |
+
equality_comparable<
|
| 44 |
+
common_reference_t<
|
| 45 |
+
const remove_reference_t<T>&,
|
| 46 |
+
const remove_reference_t<U>&>> &&
|
| 47 |
+
weakly-equality-comparable-with<T, U>;
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Given types `T` and `U`, let `t` be an lvalue of type
|
| 51 |
+
`const remove_reference_t<T>`, `u` be an lvalue of type
|
| 52 |
+
`const remove_reference_t<U>`, and `C` be:
|
| 53 |
+
|
| 54 |
+
``` cpp
|
| 55 |
+
common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
`T` and `U` model `equality_comparable_with<T, U>` only if
|
| 59 |
+
`bool(t == u) == bool(C(t) == C(u))`.
|
| 60 |
+
|