tmp/tmppcpfr2k8/{from.md → to.md}
RENAMED
|
@@ -2,26 +2,25 @@
|
|
| 2 |
|
| 3 |
The library provides basic function object classes for all of the
|
| 4 |
comparison operators in the language ([[expr.rel]], [[expr.eq]]).
|
| 5 |
|
| 6 |
For templates `less`, `greater`, `less_equal`, and `greater_equal`, the
|
| 7 |
-
specializations for any pointer type yield a
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
-
[*Note 1*:
|
| 12 |
-
|
| 13 |
-
|
| 14 |
|
| 15 |
For template specializations `less<void>`, `greater<void>`,
|
| 16 |
`less_equal<void>`, and `greater_equal<void>`, if the call operator
|
| 17 |
calls a built-in operator comparing pointers, the call operator yields a
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
operators.
|
| 21 |
|
| 22 |
-
#### Class template `equal_to` <a id="comparisons.
|
| 23 |
|
| 24 |
``` cpp
|
| 25 |
template<class T = void> struct equal_to {
|
| 26 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 27 |
};
|
|
@@ -47,11 +46,11 @@ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
|
|
| 47 |
-> decltype(std::forward<T>(t) == std::forward<U>(u));
|
| 48 |
```
|
| 49 |
|
| 50 |
*Returns:* `std::forward<T>(t) == std::forward<U>(u)`.
|
| 51 |
|
| 52 |
-
#### Class template `not_equal_to` <a id="comparisons.
|
| 53 |
|
| 54 |
``` cpp
|
| 55 |
template<class T = void> struct not_equal_to {
|
| 56 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 57 |
};
|
|
@@ -137,11 +136,11 @@ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
|
|
| 137 |
-> decltype(std::forward<T>(t) < std::forward<U>(u));
|
| 138 |
```
|
| 139 |
|
| 140 |
*Returns:* `std::forward<T>(t) < std::forward<U>(u)`.
|
| 141 |
|
| 142 |
-
#### Class template `greater_equal` <a id="comparisons.
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
template<class T = void> struct greater_equal {
|
| 146 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 147 |
};
|
|
@@ -167,11 +166,11 @@ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
|
|
| 167 |
-> decltype(std::forward<T>(t) >= std::forward<U>(u));
|
| 168 |
```
|
| 169 |
|
| 170 |
*Returns:* `std::forward<T>(t) >= std::forward<U>(u)`.
|
| 171 |
|
| 172 |
-
#### Class template `less_equal` <a id="comparisons.
|
| 173 |
|
| 174 |
``` cpp
|
| 175 |
template<class T = void> struct less_equal {
|
| 176 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 177 |
};
|
|
@@ -197,5 +196,50 @@ template <class T, class U> constexpr auto operator()(T&& t, U&& u) const
|
|
| 197 |
-> decltype(std::forward<T>(t) <= std::forward<U>(u));
|
| 198 |
```
|
| 199 |
|
| 200 |
*Returns:* `std::forward<T>(t) <= std::forward<U>(u)`.
|
| 201 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
The library provides basic function object classes for all of the
|
| 4 |
comparison operators in the language ([[expr.rel]], [[expr.eq]]).
|
| 5 |
|
| 6 |
For templates `less`, `greater`, `less_equal`, and `greater_equal`, the
|
| 7 |
+
specializations for any pointer type yield a result consistent with the
|
| 8 |
+
implementation-defined strict total order over pointers
|
| 9 |
+
[[defns.order.ptr]].
|
| 10 |
|
| 11 |
+
[*Note 1*: If `a < b` is well-defined for pointers `a` and `b` of type
|
| 12 |
+
`P`, then `(a < b) == less<P>()(a, b)`, `(a > b) == greater<P>()(a, b)`,
|
| 13 |
+
and so forth. — *end note*]
|
| 14 |
|
| 15 |
For template specializations `less<void>`, `greater<void>`,
|
| 16 |
`less_equal<void>`, and `greater_equal<void>`, if the call operator
|
| 17 |
calls a built-in operator comparing pointers, the call operator yields a
|
| 18 |
+
result consistent with the implementation-defined strict total order
|
| 19 |
+
over pointers.
|
|
|
|
| 20 |
|
| 21 |
+
#### Class template `equal_to` <a id="comparisons.equal.to">[[comparisons.equal.to]]</a>
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
template<class T = void> struct equal_to {
|
| 25 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 26 |
};
|
|
|
|
| 46 |
-> decltype(std::forward<T>(t) == std::forward<U>(u));
|
| 47 |
```
|
| 48 |
|
| 49 |
*Returns:* `std::forward<T>(t) == std::forward<U>(u)`.
|
| 50 |
|
| 51 |
+
#### Class template `not_equal_to` <a id="comparisons.not.equal.to">[[comparisons.not.equal.to]]</a>
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
template<class T = void> struct not_equal_to {
|
| 55 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 56 |
};
|
|
|
|
| 136 |
-> decltype(std::forward<T>(t) < std::forward<U>(u));
|
| 137 |
```
|
| 138 |
|
| 139 |
*Returns:* `std::forward<T>(t) < std::forward<U>(u)`.
|
| 140 |
|
| 141 |
+
#### Class template `greater_equal` <a id="comparisons.greater.equal">[[comparisons.greater.equal]]</a>
|
| 142 |
|
| 143 |
``` cpp
|
| 144 |
template<class T = void> struct greater_equal {
|
| 145 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 146 |
};
|
|
|
|
| 166 |
-> decltype(std::forward<T>(t) >= std::forward<U>(u));
|
| 167 |
```
|
| 168 |
|
| 169 |
*Returns:* `std::forward<T>(t) >= std::forward<U>(u)`.
|
| 170 |
|
| 171 |
+
#### Class template `less_equal` <a id="comparisons.less.equal">[[comparisons.less.equal]]</a>
|
| 172 |
|
| 173 |
``` cpp
|
| 174 |
template<class T = void> struct less_equal {
|
| 175 |
constexpr bool operator()(const T& x, const T& y) const;
|
| 176 |
};
|
|
|
|
| 196 |
-> decltype(std::forward<T>(t) <= std::forward<U>(u));
|
| 197 |
```
|
| 198 |
|
| 199 |
*Returns:* `std::forward<T>(t) <= std::forward<U>(u)`.
|
| 200 |
|
| 201 |
+
#### Class `compare_three_way` <a id="comparisons.three.way">[[comparisons.three.way]]</a>
|
| 202 |
+
|
| 203 |
+
In this subclause, `BUILTIN-PTR-THREE-WAY(T, U)` for types `T` and `U`
|
| 204 |
+
is a boolean constant expression. `BUILTIN-PTR-THREE-WAY(T, U)` is
|
| 205 |
+
`true` if and only if `<=>` in the expression
|
| 206 |
+
|
| 207 |
+
``` cpp
|
| 208 |
+
declval<T>() <=> declval<U>()
|
| 209 |
+
```
|
| 210 |
+
|
| 211 |
+
resolves to a built-in operator comparing pointers.
|
| 212 |
+
|
| 213 |
+
``` cpp
|
| 214 |
+
struct compare_three_way {
|
| 215 |
+
template<class T, class U>
|
| 216 |
+
requires three_way_comparable_with<T, U> || BUILTIN-PTR-THREE-WAY(T, U)
|
| 217 |
+
constexpr auto operator()(T&& t, U&& u) const;
|
| 218 |
+
|
| 219 |
+
using is_transparent = unspecified;
|
| 220 |
+
};
|
| 221 |
+
```
|
| 222 |
+
|
| 223 |
+
``` cpp
|
| 224 |
+
template<class T, class U>
|
| 225 |
+
requires three_way_comparable_with<T, U> || BUILTIN-PTR-THREE-WAY(T, U)
|
| 226 |
+
constexpr auto operator()(T&& t, U&& u) const;
|
| 227 |
+
```
|
| 228 |
+
|
| 229 |
+
*Preconditions:* If the expression
|
| 230 |
+
`std::forward<T>(t) <=> std::forward<U>(u)` results in a call to a
|
| 231 |
+
built-in operator `<=>` comparing pointers of type `P`, the conversion
|
| 232 |
+
sequences from both `T` and `U` to `P` are
|
| 233 |
+
equality-preserving [[concepts.equality]].
|
| 234 |
+
|
| 235 |
+
*Effects:*
|
| 236 |
+
|
| 237 |
+
- If the expression `std::forward<T>(t) <=> std::forward<U>(u)` results
|
| 238 |
+
in a call to a built-in operator `<=>` comparing pointers of type `P`,
|
| 239 |
+
returns `strong_ordering::less` if (the converted value of) `t`
|
| 240 |
+
precedes `u` in the implementation-defined strict total order over
|
| 241 |
+
pointers [[defns.order.ptr]], `strong_ordering::greater` if `u`
|
| 242 |
+
precedes `t`, and otherwise `strong_ordering::equal`.
|
| 243 |
+
- Otherwise, equivalent to:
|
| 244 |
+
`return std::forward<T>(t) <=> std::forward<U>(u);`
|
| 245 |
+
|