tmp/tmpw7knl_2s/{from.md → to.md}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
### Non-member comparison functions <a id="string.view.comparison">[[string.view.comparison]]</a>
|
| 2 |
|
| 3 |
Let `S` be `basic_string_view<charT, traits>`, and `sv` be an instance
|
| 4 |
of `S`. Implementations shall provide sufficient additional overloads
|
| 5 |
marked `constexpr` and `noexcept` so that an object `t` with an implicit
|
| 6 |
-
conversion to `S` can be compared according to
|
| 7 |
-
[[
|
| 8 |
|
| 9 |
-
**Table: Additional `basic_string_view` comparison overloads** <a id="
|
| 10 |
|
| 11 |
| Expression | Equivalent to |
|
| 12 |
| ---------- | ------------- |
|
| 13 |
| `t == sv` | `S(t) == sv` |
|
| 14 |
| `sv == t` | `sv == S(t)` |
|
|
@@ -20,31 +20,27 @@ conversion to `S` can be compared according to Table
|
|
| 20 |
| `sv > t` | `sv > S(t)` |
|
| 21 |
| `t <= sv` | `S(t) <= sv` |
|
| 22 |
| `sv <= t` | `sv <= S(t)` |
|
| 23 |
| `t >= sv` | `S(t) >= sv` |
|
| 24 |
| `sv >= t` | `sv >= S(t)` |
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
[*Example 1*:
|
| 28 |
|
| 29 |
A sample conforming implementation for `operator==` would be:
|
| 30 |
|
| 31 |
``` cpp
|
| 32 |
-
template<class T> using __identity = decay_t<T>;
|
| 33 |
template<class charT, class traits>
|
| 34 |
constexpr bool operator==(basic_string_view<charT, traits> lhs,
|
| 35 |
basic_string_view<charT, traits> rhs) noexcept {
|
| 36 |
return lhs.compare(rhs) == 0;
|
| 37 |
}
|
| 38 |
template<class charT, class traits>
|
| 39 |
constexpr bool operator==(basic_string_view<charT, traits> lhs,
|
| 40 |
-
|
| 41 |
-
return lhs.compare(rhs) == 0;
|
| 42 |
-
}
|
| 43 |
-
template<class charT, class traits>
|
| 44 |
-
constexpr bool operator==(__identity<basic_string_view<charT, traits>> lhs,
|
| 45 |
-
basic_string_view<charT, traits> rhs) noexcept {
|
| 46 |
return lhs.compare(rhs) == 0;
|
| 47 |
}
|
| 48 |
```
|
| 49 |
|
| 50 |
— *end example*]
|
|
@@ -57,43 +53,14 @@ template<class charT, class traits>
|
|
| 57 |
|
| 58 |
*Returns:* `lhs.compare(rhs) == 0`.
|
| 59 |
|
| 60 |
``` cpp
|
| 61 |
template<class charT, class traits>
|
| 62 |
-
constexpr
|
| 63 |
-
|
| 64 |
```
|
| 65 |
|
| 66 |
-
|
|
|
|
| 67 |
|
| 68 |
-
`
|
| 69 |
-
template<class charT, class traits>
|
| 70 |
-
constexpr bool operator< (basic_string_view<charT, traits> lhs,
|
| 71 |
-
basic_string_view<charT, traits> rhs) noexcept;
|
| 72 |
-
```
|
| 73 |
-
|
| 74 |
-
*Returns:* `lhs.compare(rhs) < 0`.
|
| 75 |
-
|
| 76 |
-
``` cpp
|
| 77 |
-
template<class charT, class traits>
|
| 78 |
-
constexpr bool operator> (basic_string_view<charT, traits> lhs,
|
| 79 |
-
basic_string_view<charT, traits> rhs) noexcept;
|
| 80 |
-
```
|
| 81 |
-
|
| 82 |
-
*Returns:* `lhs.compare(rhs) > 0`.
|
| 83 |
-
|
| 84 |
-
``` cpp
|
| 85 |
-
template<class charT, class traits>
|
| 86 |
-
constexpr bool operator<=(basic_string_view<charT, traits> lhs,
|
| 87 |
-
basic_string_view<charT, traits> rhs) noexcept;
|
| 88 |
-
```
|
| 89 |
-
|
| 90 |
-
*Returns:* `lhs.compare(rhs) <= 0`.
|
| 91 |
-
|
| 92 |
-
``` cpp
|
| 93 |
-
template<class charT, class traits>
|
| 94 |
-
constexpr bool operator>=(basic_string_view<charT, traits> lhs,
|
| 95 |
-
basic_string_view<charT, traits> rhs) noexcept;
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
*Returns:* `lhs.compare(rhs) >= 0`.
|
| 99 |
|
|
|
|
| 1 |
### Non-member comparison functions <a id="string.view.comparison">[[string.view.comparison]]</a>
|
| 2 |
|
| 3 |
Let `S` be `basic_string_view<charT, traits>`, and `sv` be an instance
|
| 4 |
of `S`. Implementations shall provide sufficient additional overloads
|
| 5 |
marked `constexpr` and `noexcept` so that an object `t` with an implicit
|
| 6 |
+
conversion to `S` can be compared according to
|
| 7 |
+
[[string.view.comparison.overloads]].
|
| 8 |
|
| 9 |
+
**Table: Additional `basic_string_view` comparison overloads** <a id="string.view.comparison.overloads">[string.view.comparison.overloads]</a>
|
| 10 |
|
| 11 |
| Expression | Equivalent to |
|
| 12 |
| ---------- | ------------- |
|
| 13 |
| `t == sv` | `S(t) == sv` |
|
| 14 |
| `sv == t` | `sv == S(t)` |
|
|
|
|
| 20 |
| `sv > t` | `sv > S(t)` |
|
| 21 |
| `t <= sv` | `S(t) <= sv` |
|
| 22 |
| `sv <= t` | `sv <= S(t)` |
|
| 23 |
| `t >= sv` | `S(t) >= sv` |
|
| 24 |
| `sv >= t` | `sv >= S(t)` |
|
| 25 |
+
| `t <=> sv` | `S(t) <=> sv` |
|
| 26 |
+
| `sv <=> t` | `sv <=> S(t)` |
|
| 27 |
|
| 28 |
|
| 29 |
[*Example 1*:
|
| 30 |
|
| 31 |
A sample conforming implementation for `operator==` would be:
|
| 32 |
|
| 33 |
``` cpp
|
|
|
|
| 34 |
template<class charT, class traits>
|
| 35 |
constexpr bool operator==(basic_string_view<charT, traits> lhs,
|
| 36 |
basic_string_view<charT, traits> rhs) noexcept {
|
| 37 |
return lhs.compare(rhs) == 0;
|
| 38 |
}
|
| 39 |
template<class charT, class traits>
|
| 40 |
constexpr bool operator==(basic_string_view<charT, traits> lhs,
|
| 41 |
+
type_identity_t<basic_string_view<charT, traits>> rhs) noexcept {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
return lhs.compare(rhs) == 0;
|
| 43 |
}
|
| 44 |
```
|
| 45 |
|
| 46 |
— *end example*]
|
|
|
|
| 53 |
|
| 54 |
*Returns:* `lhs.compare(rhs) == 0`.
|
| 55 |
|
| 56 |
``` cpp
|
| 57 |
template<class charT, class traits>
|
| 58 |
+
constexpr see below operator<=>(basic_string_view<charT, traits> lhs,
|
| 59 |
+
\itcorr basic_string_view<charT, traits> rhs) noexcept;
|
| 60 |
```
|
| 61 |
|
| 62 |
+
Let `R` denote the type `traits::comparison_category` if it exists,
|
| 63 |
+
otherwise `R` is `weak_ordering`.
|
| 64 |
|
| 65 |
+
*Returns:* `static_cast<R>(lhs.compare(rhs) <=> 0)`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|