tmp/tmpnk42ab5p/{from.md → to.md}
RENAMED
|
@@ -1,45 +1,47 @@
|
|
| 1 |
### `basic_string` non-member functions <a id="string.nonmembers">[[string.nonmembers]]</a>
|
| 2 |
|
| 3 |
-
#### `operator+` <a id="string
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
template<class charT, class traits, class Allocator>
|
| 7 |
basic_string<charT, traits, Allocator>
|
| 8 |
operator+(const basic_string<charT, traits, Allocator>& lhs,
|
| 9 |
const basic_string<charT, traits, Allocator>& rhs);
|
| 10 |
```
|
| 11 |
|
| 12 |
-
*Returns:* `basic_string<charT,traits,Allocator>(lhs).append(rhs)`
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
template<class charT, class traits, class Allocator>
|
| 16 |
basic_string<charT, traits, Allocator>
|
| 17 |
operator+(basic_string<charT, traits, Allocator>&& lhs,
|
| 18 |
const basic_string<charT, traits, Allocator>& rhs);
|
| 19 |
```
|
| 20 |
|
| 21 |
-
*Returns:* `std::move(lhs.append(rhs))`
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
template<class charT, class traits, class Allocator>
|
| 25 |
basic_string<charT, traits, Allocator>
|
| 26 |
operator+(const basic_string<charT, traits, Allocator>& lhs,
|
| 27 |
basic_string<charT, traits, Allocator>&& rhs);
|
| 28 |
```
|
| 29 |
|
| 30 |
-
*Returns:* `std::move(rhs.insert(0, lhs))`
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
template<class charT, class traits, class Allocator>
|
| 34 |
basic_string<charT, traits, Allocator>
|
| 35 |
operator+(basic_string<charT, traits, Allocator>&& lhs,
|
| 36 |
basic_string<charT, traits, Allocator>&& rhs);
|
| 37 |
```
|
| 38 |
|
| 39 |
-
*Returns:* `std::move(lhs.append(rhs))`
|
| 40 |
-
|
|
|
|
|
|
|
| 41 |
|
| 42 |
``` cpp
|
| 43 |
template<class charT, class traits, class Allocator>
|
| 44 |
basic_string<charT, traits, Allocator>
|
| 45 |
operator+(const charT* lhs,
|
|
@@ -117,11 +119,11 @@ template<class charT, class traits, class Allocator>
|
|
| 117 |
charT rhs);
|
| 118 |
```
|
| 119 |
|
| 120 |
*Returns:* `std::move(lhs.append(1, rhs))`.
|
| 121 |
|
| 122 |
-
#### `operator==` <a id="string
|
| 123 |
|
| 124 |
``` cpp
|
| 125 |
template<class charT, class traits, class Allocator>
|
| 126 |
bool operator==(const basic_string<charT, traits, Allocator>& lhs,
|
| 127 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -146,11 +148,11 @@ template<class charT, class traits, class Allocator>
|
|
| 146 |
*Requires:* `rhs` points to an array of at least
|
| 147 |
`traits::length(rhs) + 1` elements of `charT`.
|
| 148 |
|
| 149 |
*Returns:* `lhs.compare(rhs) == 0`.
|
| 150 |
|
| 151 |
-
#### `operator!=` <a id="string
|
| 152 |
|
| 153 |
``` cpp
|
| 154 |
template<class charT, class traits, class Allocator>
|
| 155 |
bool operator!=(const basic_string<charT, traits, Allocator>& lhs,
|
| 156 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -175,11 +177,11 @@ template<class charT, class traits, class Allocator>
|
|
| 175 |
*Requires:* `rhs` points to an array of at least
|
| 176 |
`traits::length(rhs) + 1` elements of `charT`.
|
| 177 |
|
| 178 |
*Returns:* `lhs.compare(rhs) != 0`.
|
| 179 |
|
| 180 |
-
#### `operator<` <a id="string
|
| 181 |
|
| 182 |
``` cpp
|
| 183 |
template<class charT, class traits, class Allocator>
|
| 184 |
bool operator< (const basic_string<charT, traits, Allocator>& lhs,
|
| 185 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -201,11 +203,11 @@ template<class charT, class traits, class Allocator>
|
|
| 201 |
const charT* rhs);
|
| 202 |
```
|
| 203 |
|
| 204 |
*Returns:* `lhs.compare(rhs) < 0`.
|
| 205 |
|
| 206 |
-
#### `operator>` <a id="string
|
| 207 |
|
| 208 |
``` cpp
|
| 209 |
template<class charT, class traits, class Allocator>
|
| 210 |
bool operator> (const basic_string<charT, traits, Allocator>& lhs,
|
| 211 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -227,11 +229,11 @@ template<class charT, class traits, class Allocator>
|
|
| 227 |
const charT* rhs);
|
| 228 |
```
|
| 229 |
|
| 230 |
*Returns:* `lhs.compare(rhs) > 0`.
|
| 231 |
|
| 232 |
-
#### `operator<=` <a id="string
|
| 233 |
|
| 234 |
``` cpp
|
| 235 |
template<class charT, class traits, class Allocator>
|
| 236 |
bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
|
| 237 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -253,11 +255,11 @@ template<class charT, class traits, class Allocator>
|
|
| 253 |
const charT* rhs);
|
| 254 |
```
|
| 255 |
|
| 256 |
*Returns:* `lhs.compare(rhs) <= 0`.
|
| 257 |
|
| 258 |
-
#### `operator>=` <a id="string
|
| 259 |
|
| 260 |
``` cpp
|
| 261 |
template<class charT, class traits, class Allocator>
|
| 262 |
bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
|
| 263 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
@@ -284,14 +286,15 @@ template<class charT, class traits, class Allocator>
|
|
| 284 |
#### `swap` <a id="string.special">[[string.special]]</a>
|
| 285 |
|
| 286 |
``` cpp
|
| 287 |
template<class charT, class traits, class Allocator>
|
| 288 |
void swap(basic_string<charT, traits, Allocator>& lhs,
|
| 289 |
-
|
|
|
|
| 290 |
```
|
| 291 |
|
| 292 |
-
*Effects:* Equivalent to `lhs.swap(rhs);`
|
| 293 |
|
| 294 |
#### Inserters and extractors <a id="string.io">[[string.io]]</a>
|
| 295 |
|
| 296 |
``` cpp
|
| 297 |
template<class charT, class traits, class Allocator>
|
|
@@ -300,47 +303,40 @@ template<class charT, class traits, class Allocator>
|
|
| 300 |
basic_string<charT, traits, Allocator>& str);
|
| 301 |
```
|
| 302 |
|
| 303 |
*Effects:* Behaves as a formatted input
|
| 304 |
function ([[istream.formatted.reqmts]]). After constructing a `sentry`
|
| 305 |
-
object, if the sentry converts to true, calls `str.erase()` and then
|
| 306 |
extracts characters from `is` and appends them to `str` as if by calling
|
| 307 |
`str.append(1, c)`. If `is.width()` is greater than zero, the maximum
|
| 308 |
number `n` of characters appended is `is.width()`; otherwise `n` is
|
| 309 |
`str.max_size()`. Characters are extracted and appended until any of the
|
| 310 |
following occurs:
|
| 311 |
|
| 312 |
- *n* characters are stored;
|
| 313 |
- end-of-file occurs on the input sequence;
|
| 314 |
-
- `isspace(c,is.getloc())` is true for the next available input
|
| 315 |
character *c*.
|
| 316 |
|
| 317 |
After the last character (if any) is extracted, `is.width(0)` is called
|
| 318 |
-
and the `sentry` object
|
| 319 |
|
| 320 |
If the function extracts no characters, it calls
|
| 321 |
`is.setstate(ios::failbit)`, which may throw
|
| 322 |
`ios_base::failure` ([[iostate.flags]]).
|
| 323 |
|
| 324 |
-
*Returns:* `is`
|
| 325 |
|
| 326 |
``` cpp
|
| 327 |
template<class charT, class traits, class Allocator>
|
| 328 |
basic_ostream<charT, traits>&
|
| 329 |
operator<<(basic_ostream<charT, traits>& os,
|
| 330 |
const basic_string<charT, traits, Allocator>& str);
|
| 331 |
```
|
| 332 |
|
| 333 |
-
*Effects:*
|
| 334 |
-
|
| 335 |
-
sequence `seq`, initially consisting of the elements defined by the
|
| 336 |
-
range \[`str.begin(), str.end()`). Determines padding for `seq` as
|
| 337 |
-
described in [[ostream.formatted.reqmts]]. Then inserts `seq` as if by
|
| 338 |
-
calling `os.rdbuf()->sputn(seq, n)`, where `n` is the larger of
|
| 339 |
-
`os.width()` and `str.size()`; then calls `os.width(0)`.
|
| 340 |
-
|
| 341 |
-
*Returns:* `os`
|
| 342 |
|
| 343 |
``` cpp
|
| 344 |
template<class charT, class traits, class Allocator>
|
| 345 |
basic_istream<charT, traits>&
|
| 346 |
getline(basic_istream<charT, traits>& is,
|
|
@@ -354,11 +350,11 @@ template<class charT, class traits, class Allocator>
|
|
| 354 |
```
|
| 355 |
|
| 356 |
*Effects:* Behaves as an unformatted input
|
| 357 |
function ([[istream.unformatted]]), except that it does not affect the
|
| 358 |
value returned by subsequent calls to `basic_istream<>::gcount()`. After
|
| 359 |
-
constructing a `sentry` object, if the sentry converts to true, calls
|
| 360 |
`str.erase()` and then extracts characters from `is` and appends them to
|
| 361 |
`str` as if by calling `str.append(1, c)` until any of the following
|
| 362 |
occurs:
|
| 363 |
|
| 364 |
- end-of-file occurs on the input sequence (in which case, the `getline`
|
|
@@ -367,11 +363,11 @@ occurs:
|
|
| 367 |
which case, *c* is extracted but not appended) ([[iostate.flags]])
|
| 368 |
- `str.max_size()` characters are stored (in which case, the function
|
| 369 |
calls `is.setstate(ios_base::failbit))` ([[iostate.flags]])
|
| 370 |
|
| 371 |
The conditions are tested in the order shown. In any case, after the
|
| 372 |
-
last character is extracted, the `sentry` object
|
| 373 |
|
| 374 |
If the function extracts no characters, it calls
|
| 375 |
`is.setstate(ios_base::failbit)` which may throw
|
| 376 |
`ios_base::failure` ([[iostate.flags]]).
|
| 377 |
|
|
@@ -386,7 +382,7 @@ template<class charT, class traits, class Allocator>
|
|
| 386 |
basic_istream<charT, traits>&
|
| 387 |
getline(basic_istream<charT, traits>&& is,
|
| 388 |
basic_string<charT, traits, Allocator>& str);
|
| 389 |
```
|
| 390 |
|
| 391 |
-
*Returns:* `getline(is,str,is.widen(’\n’))`
|
| 392 |
|
|
|
|
| 1 |
### `basic_string` non-member functions <a id="string.nonmembers">[[string.nonmembers]]</a>
|
| 2 |
|
| 3 |
+
#### `operator+` <a id="string.op+">[[string.op+]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
template<class charT, class traits, class Allocator>
|
| 7 |
basic_string<charT, traits, Allocator>
|
| 8 |
operator+(const basic_string<charT, traits, Allocator>& lhs,
|
| 9 |
const basic_string<charT, traits, Allocator>& rhs);
|
| 10 |
```
|
| 11 |
|
| 12 |
+
*Returns:* `basic_string<charT, traits, Allocator>(lhs).append(rhs)`.
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
template<class charT, class traits, class Allocator>
|
| 16 |
basic_string<charT, traits, Allocator>
|
| 17 |
operator+(basic_string<charT, traits, Allocator>&& lhs,
|
| 18 |
const basic_string<charT, traits, Allocator>& rhs);
|
| 19 |
```
|
| 20 |
|
| 21 |
+
*Returns:* `std::move(lhs.append(rhs))`.
|
| 22 |
|
| 23 |
``` cpp
|
| 24 |
template<class charT, class traits, class Allocator>
|
| 25 |
basic_string<charT, traits, Allocator>
|
| 26 |
operator+(const basic_string<charT, traits, Allocator>& lhs,
|
| 27 |
basic_string<charT, traits, Allocator>&& rhs);
|
| 28 |
```
|
| 29 |
|
| 30 |
+
*Returns:* `std::move(rhs.insert(0, lhs))`.
|
| 31 |
|
| 32 |
``` cpp
|
| 33 |
template<class charT, class traits, class Allocator>
|
| 34 |
basic_string<charT, traits, Allocator>
|
| 35 |
operator+(basic_string<charT, traits, Allocator>&& lhs,
|
| 36 |
basic_string<charT, traits, Allocator>&& rhs);
|
| 37 |
```
|
| 38 |
|
| 39 |
+
*Returns:* `std::move(lhs.append(rhs))`.
|
| 40 |
+
|
| 41 |
+
[*Note 1*: Or equivalently,
|
| 42 |
+
`std::move(rhs.insert(0, lhs))`. — *end note*]
|
| 43 |
|
| 44 |
``` cpp
|
| 45 |
template<class charT, class traits, class Allocator>
|
| 46 |
basic_string<charT, traits, Allocator>
|
| 47 |
operator+(const charT* lhs,
|
|
|
|
| 119 |
charT rhs);
|
| 120 |
```
|
| 121 |
|
| 122 |
*Returns:* `std::move(lhs.append(1, rhs))`.
|
| 123 |
|
| 124 |
+
#### `operator==` <a id="string.operator==">[[string.operator==]]</a>
|
| 125 |
|
| 126 |
``` cpp
|
| 127 |
template<class charT, class traits, class Allocator>
|
| 128 |
bool operator==(const basic_string<charT, traits, Allocator>& lhs,
|
| 129 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 148 |
*Requires:* `rhs` points to an array of at least
|
| 149 |
`traits::length(rhs) + 1` elements of `charT`.
|
| 150 |
|
| 151 |
*Returns:* `lhs.compare(rhs) == 0`.
|
| 152 |
|
| 153 |
+
#### `operator!=` <a id="string.op!=">[[string.op!=]]</a>
|
| 154 |
|
| 155 |
``` cpp
|
| 156 |
template<class charT, class traits, class Allocator>
|
| 157 |
bool operator!=(const basic_string<charT, traits, Allocator>& lhs,
|
| 158 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 177 |
*Requires:* `rhs` points to an array of at least
|
| 178 |
`traits::length(rhs) + 1` elements of `charT`.
|
| 179 |
|
| 180 |
*Returns:* `lhs.compare(rhs) != 0`.
|
| 181 |
|
| 182 |
+
#### `operator<` <a id="string.op<">[[string.op<]]</a>
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
template<class charT, class traits, class Allocator>
|
| 186 |
bool operator< (const basic_string<charT, traits, Allocator>& lhs,
|
| 187 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 203 |
const charT* rhs);
|
| 204 |
```
|
| 205 |
|
| 206 |
*Returns:* `lhs.compare(rhs) < 0`.
|
| 207 |
|
| 208 |
+
#### `operator>` <a id="string.op>">[[string.op>]]</a>
|
| 209 |
|
| 210 |
``` cpp
|
| 211 |
template<class charT, class traits, class Allocator>
|
| 212 |
bool operator> (const basic_string<charT, traits, Allocator>& lhs,
|
| 213 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 229 |
const charT* rhs);
|
| 230 |
```
|
| 231 |
|
| 232 |
*Returns:* `lhs.compare(rhs) > 0`.
|
| 233 |
|
| 234 |
+
#### `operator<=` <a id="string.op<=">[[string.op<=]]</a>
|
| 235 |
|
| 236 |
``` cpp
|
| 237 |
template<class charT, class traits, class Allocator>
|
| 238 |
bool operator<=(const basic_string<charT, traits, Allocator>& lhs,
|
| 239 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 255 |
const charT* rhs);
|
| 256 |
```
|
| 257 |
|
| 258 |
*Returns:* `lhs.compare(rhs) <= 0`.
|
| 259 |
|
| 260 |
+
#### `operator>=` <a id="string.op>=">[[string.op>=]]</a>
|
| 261 |
|
| 262 |
``` cpp
|
| 263 |
template<class charT, class traits, class Allocator>
|
| 264 |
bool operator>=(const basic_string<charT, traits, Allocator>& lhs,
|
| 265 |
const basic_string<charT, traits, Allocator>& rhs) noexcept;
|
|
|
|
| 286 |
#### `swap` <a id="string.special">[[string.special]]</a>
|
| 287 |
|
| 288 |
``` cpp
|
| 289 |
template<class charT, class traits, class Allocator>
|
| 290 |
void swap(basic_string<charT, traits, Allocator>& lhs,
|
| 291 |
+
basic_string<charT, traits, Allocator>& rhs)
|
| 292 |
+
noexcept(noexcept(lhs.swap(rhs)));
|
| 293 |
```
|
| 294 |
|
| 295 |
+
*Effects:* Equivalent to: `lhs.swap(rhs);`
|
| 296 |
|
| 297 |
#### Inserters and extractors <a id="string.io">[[string.io]]</a>
|
| 298 |
|
| 299 |
``` cpp
|
| 300 |
template<class charT, class traits, class Allocator>
|
|
|
|
| 303 |
basic_string<charT, traits, Allocator>& str);
|
| 304 |
```
|
| 305 |
|
| 306 |
*Effects:* Behaves as a formatted input
|
| 307 |
function ([[istream.formatted.reqmts]]). After constructing a `sentry`
|
| 308 |
+
object, if the sentry converts to `true`, calls `str.erase()` and then
|
| 309 |
extracts characters from `is` and appends them to `str` as if by calling
|
| 310 |
`str.append(1, c)`. If `is.width()` is greater than zero, the maximum
|
| 311 |
number `n` of characters appended is `is.width()`; otherwise `n` is
|
| 312 |
`str.max_size()`. Characters are extracted and appended until any of the
|
| 313 |
following occurs:
|
| 314 |
|
| 315 |
- *n* characters are stored;
|
| 316 |
- end-of-file occurs on the input sequence;
|
| 317 |
+
- `isspace(c, is.getloc())` is `true` for the next available input
|
| 318 |
character *c*.
|
| 319 |
|
| 320 |
After the last character (if any) is extracted, `is.width(0)` is called
|
| 321 |
+
and the `sentry` object is destroyed.
|
| 322 |
|
| 323 |
If the function extracts no characters, it calls
|
| 324 |
`is.setstate(ios::failbit)`, which may throw
|
| 325 |
`ios_base::failure` ([[iostate.flags]]).
|
| 326 |
|
| 327 |
+
*Returns:* `is`.
|
| 328 |
|
| 329 |
``` cpp
|
| 330 |
template<class charT, class traits, class Allocator>
|
| 331 |
basic_ostream<charT, traits>&
|
| 332 |
operator<<(basic_ostream<charT, traits>& os,
|
| 333 |
const basic_string<charT, traits, Allocator>& str);
|
| 334 |
```
|
| 335 |
|
| 336 |
+
*Effects:* Equivalent to:
|
| 337 |
+
`return os << basic_string_view<charT, traits>(str);`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
|
| 339 |
``` cpp
|
| 340 |
template<class charT, class traits, class Allocator>
|
| 341 |
basic_istream<charT, traits>&
|
| 342 |
getline(basic_istream<charT, traits>& is,
|
|
|
|
| 350 |
```
|
| 351 |
|
| 352 |
*Effects:* Behaves as an unformatted input
|
| 353 |
function ([[istream.unformatted]]), except that it does not affect the
|
| 354 |
value returned by subsequent calls to `basic_istream<>::gcount()`. After
|
| 355 |
+
constructing a `sentry` object, if the sentry converts to `true`, calls
|
| 356 |
`str.erase()` and then extracts characters from `is` and appends them to
|
| 357 |
`str` as if by calling `str.append(1, c)` until any of the following
|
| 358 |
occurs:
|
| 359 |
|
| 360 |
- end-of-file occurs on the input sequence (in which case, the `getline`
|
|
|
|
| 363 |
which case, *c* is extracted but not appended) ([[iostate.flags]])
|
| 364 |
- `str.max_size()` characters are stored (in which case, the function
|
| 365 |
calls `is.setstate(ios_base::failbit))` ([[iostate.flags]])
|
| 366 |
|
| 367 |
The conditions are tested in the order shown. In any case, after the
|
| 368 |
+
last character is extracted, the `sentry` object is destroyed.
|
| 369 |
|
| 370 |
If the function extracts no characters, it calls
|
| 371 |
`is.setstate(ios_base::failbit)` which may throw
|
| 372 |
`ios_base::failure` ([[iostate.flags]]).
|
| 373 |
|
|
|
|
| 382 |
basic_istream<charT, traits>&
|
| 383 |
getline(basic_istream<charT, traits>&& is,
|
| 384 |
basic_string<charT, traits, Allocator>& str);
|
| 385 |
```
|
| 386 |
|
| 387 |
+
*Returns:* `getline(is, str, is.widen(’\n’))`.
|
| 388 |
|