tmp/tmpjfp_t2nf/{from.md → to.md}
RENAMED
|
@@ -131,10 +131,18 @@ template<class InputIterator>
|
|
| 131 |
iterator [[container.requirements.general]].
|
| 132 |
|
| 133 |
*Effects:* Equivalent to:
|
| 134 |
`return append(basic_string(first, last, get_allocator()));`
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
``` cpp
|
| 137 |
constexpr basic_string& append(initializer_list<charT> il);
|
| 138 |
```
|
| 139 |
|
| 140 |
*Effects:* Equivalent to: `return append(il.begin(), il.size());`
|
|
@@ -251,10 +259,18 @@ template<class InputIterator>
|
|
| 251 |
iterator [[container.requirements.general]].
|
| 252 |
|
| 253 |
*Effects:* Equivalent to:
|
| 254 |
`return assign(basic_string(first, last, get_allocator()));`
|
| 255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
##### `basic_string::insert` <a id="string.insert">[[string.insert]]</a>
|
| 257 |
|
| 258 |
``` cpp
|
| 259 |
constexpr basic_string& insert(size_type pos, const basic_string& str);
|
| 260 |
```
|
|
@@ -313,22 +329,22 @@ return insert(pos1, sv.substr(pos2, n));
|
|
| 313 |
constexpr basic_string& insert(size_type pos, const charT* s, size_type n);
|
| 314 |
```
|
| 315 |
|
| 316 |
*Preconditions:* \[`s`, `s + n`) is a valid range.
|
| 317 |
|
| 318 |
-
*Throws:*
|
| 319 |
-
|
| 320 |
-
- `out_of_range` if `pos > size()`,
|
| 321 |
-
- `length_error` if `n > max_size() - size()`, or
|
| 322 |
-
- any exceptions thrown by `allocator_traits<Allocator>::allocate`.
|
| 323 |
-
|
| 324 |
*Effects:* Inserts a copy of the range \[`s`, `s + n`) immediately
|
| 325 |
before the character at position `pos` if `pos < size()`, or otherwise
|
| 326 |
at the end of the string.
|
| 327 |
|
| 328 |
*Returns:* `*this`.
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
``` cpp
|
| 331 |
constexpr basic_string& insert(size_type pos, const charT* s);
|
| 332 |
```
|
| 333 |
|
| 334 |
*Effects:* Equivalent to: `return insert(pos, s, traits::length(s));`
|
|
@@ -383,10 +399,23 @@ iterator [[container.requirements.general]].
|
|
| 383 |
`insert(p - begin(), basic_string(first, last, get_allocator()))`.
|
| 384 |
|
| 385 |
*Returns:* An iterator which refers to the first inserted character, or
|
| 386 |
`p` if `first == last`.
|
| 387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
``` cpp
|
| 389 |
constexpr iterator insert(const_iterator p, initializer_list<charT> il);
|
| 390 |
```
|
| 391 |
|
| 392 |
*Effects:* Equivalent to: `return insert(p, il.begin(), il.end());`
|
|
@@ -395,57 +424,57 @@ constexpr iterator insert(const_iterator p, initializer_list<charT> il);
|
|
| 395 |
|
| 396 |
``` cpp
|
| 397 |
constexpr basic_string& erase(size_type pos = 0, size_type n = npos);
|
| 398 |
```
|
| 399 |
|
| 400 |
-
*Throws:* `out_of_range` if `pos` `> size()`.
|
| 401 |
-
|
| 402 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 403 |
removed as the smaller of `n` and `size() - pos`. Removes the characters
|
| 404 |
in the range \[`begin() + pos`, `begin() + pos + xlen`).
|
| 405 |
|
| 406 |
*Returns:* `*this`.
|
| 407 |
|
|
|
|
|
|
|
| 408 |
``` cpp
|
| 409 |
constexpr iterator erase(const_iterator p);
|
| 410 |
```
|
| 411 |
|
| 412 |
*Preconditions:* `p` is a valid dereferenceable iterator on `*this`.
|
| 413 |
|
| 414 |
-
*Throws:* Nothing.
|
| 415 |
-
|
| 416 |
*Effects:* Removes the character referred to by `p`.
|
| 417 |
|
| 418 |
*Returns:* An iterator which points to the element immediately following
|
| 419 |
`p` prior to the element being erased. If no such element exists,
|
| 420 |
`end()` is returned.
|
| 421 |
|
|
|
|
|
|
|
| 422 |
``` cpp
|
| 423 |
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 424 |
```
|
| 425 |
|
| 426 |
*Preconditions:* `first` and `last` are valid iterators on `*this`.
|
| 427 |
\[`first`, `last`) is a valid range.
|
| 428 |
|
| 429 |
-
*Throws:* Nothing.
|
| 430 |
-
|
| 431 |
*Effects:* Removes the characters in the range `[first, last)`.
|
| 432 |
|
| 433 |
*Returns:* An iterator which points to the element pointed to by `last`
|
| 434 |
prior to the other elements being erased. If no such element exists,
|
| 435 |
`end()` is returned.
|
| 436 |
|
|
|
|
|
|
|
| 437 |
``` cpp
|
| 438 |
constexpr void pop_back();
|
| 439 |
```
|
| 440 |
|
| 441 |
*Preconditions:* `!empty()`.
|
| 442 |
|
| 443 |
-
*Throws:* Nothing.
|
| 444 |
-
|
| 445 |
*Effects:* Equivalent to `erase(end() - 1)`.
|
| 446 |
|
|
|
|
|
|
|
| 447 |
##### `basic_string::replace` <a id="string.replace">[[string.replace]]</a>
|
| 448 |
|
| 449 |
``` cpp
|
| 450 |
constexpr basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
|
| 451 |
```
|
|
@@ -505,25 +534,25 @@ return replace(pos1, n1, sv.substr(pos2, n2));
|
|
| 505 |
constexpr basic_string& replace(size_type pos1, size_type n1, const charT* s, size_type n2);
|
| 506 |
```
|
| 507 |
|
| 508 |
*Preconditions:* \[`s`, `s + n2`) is a valid range.
|
| 509 |
|
| 510 |
-
*Throws:*
|
| 511 |
-
|
| 512 |
-
- `out_of_range` if `pos1 > size()`,
|
| 513 |
-
- `length_error` if the length of the resulting string would exceed
|
| 514 |
-
`max_size()` (see below), or
|
| 515 |
-
- any exceptions thrown by `allocator_traits<Allocator>::allocate`.
|
| 516 |
-
|
| 517 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 518 |
removed as the smaller of `n1` and `size() - pos1`. If
|
| 519 |
`size() - xlen >= max_size() - n2` throws `length_error`. Otherwise, the
|
| 520 |
function replaces the characters in the range \[`begin() + pos1`,
|
| 521 |
`begin() + pos1 + xlen`) with a copy of the range \[`s`, `s + n2`).
|
| 522 |
|
| 523 |
*Returns:* `*this`.
|
| 524 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 525 |
``` cpp
|
| 526 |
constexpr basic_string& replace(size_type pos, size_type n, const charT* s);
|
| 527 |
```
|
| 528 |
|
| 529 |
*Effects:* Equivalent to:
|
|
@@ -531,25 +560,25 @@ constexpr basic_string& replace(size_type pos, size_type n, const charT* s);
|
|
| 531 |
|
| 532 |
``` cpp
|
| 533 |
constexpr basic_string& replace(size_type pos1, size_type n1, size_type n2, charT c);
|
| 534 |
```
|
| 535 |
|
| 536 |
-
*Throws:*
|
| 537 |
-
|
| 538 |
-
- `out_of_range` if `pos1 > size()`,
|
| 539 |
-
- `length_error` if the length of the resulting string would exceed
|
| 540 |
-
`max_size()` (see below), or
|
| 541 |
-
- any exceptions thrown by `allocator_traits<Allocator>::allocate.`
|
| 542 |
-
|
| 543 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 544 |
removed as the smaller of `n1` and `size() - pos1`. If
|
| 545 |
`size() - xlen >=` `max_size() - n2` throws `length_error`. Otherwise,
|
| 546 |
the function replaces the characters in the range \[`begin() + pos1`,
|
| 547 |
`begin() + pos1 + xlen`) with `n2` copies of `c`.
|
| 548 |
|
| 549 |
*Returns:* `*this`.
|
| 550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
``` cpp
|
| 552 |
constexpr basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
| 553 |
```
|
| 554 |
|
| 555 |
*Effects:* Equivalent to:
|
|
@@ -607,10 +636,21 @@ template<class InputIterator>
|
|
| 607 |
iterator [[container.requirements.general]].
|
| 608 |
|
| 609 |
*Effects:* Equivalent to:
|
| 610 |
`return replace(i1, i2, basic_string(j1, j2, get_allocator()));`
|
| 611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
``` cpp
|
| 613 |
constexpr basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
|
| 614 |
```
|
| 615 |
|
| 616 |
*Effects:* Equivalent to:
|
|
|
|
| 131 |
iterator [[container.requirements.general]].
|
| 132 |
|
| 133 |
*Effects:* Equivalent to:
|
| 134 |
`return append(basic_string(first, last, get_allocator()));`
|
| 135 |
|
| 136 |
+
``` cpp
|
| 137 |
+
template<container-compatible-range<charT> R>
|
| 138 |
+
constexpr basic_string& append_range(R&& rg);
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
*Effects:* Equivalent to:
|
| 142 |
+
`return append(basic_string(from_range, std::forward<R>(rg), get_allocator()));`
|
| 143 |
+
|
| 144 |
``` cpp
|
| 145 |
constexpr basic_string& append(initializer_list<charT> il);
|
| 146 |
```
|
| 147 |
|
| 148 |
*Effects:* Equivalent to: `return append(il.begin(), il.size());`
|
|
|
|
| 259 |
iterator [[container.requirements.general]].
|
| 260 |
|
| 261 |
*Effects:* Equivalent to:
|
| 262 |
`return assign(basic_string(first, last, get_allocator()));`
|
| 263 |
|
| 264 |
+
``` cpp
|
| 265 |
+
template<container-compatible-range<charT> R>
|
| 266 |
+
constexpr basic_string& assign_range(R&& rg);
|
| 267 |
+
```
|
| 268 |
+
|
| 269 |
+
*Effects:* Equivalent to:
|
| 270 |
+
`return assign(basic_string(from_range, std::forward<R>(rg), get_allocator()));`
|
| 271 |
+
|
| 272 |
##### `basic_string::insert` <a id="string.insert">[[string.insert]]</a>
|
| 273 |
|
| 274 |
``` cpp
|
| 275 |
constexpr basic_string& insert(size_type pos, const basic_string& str);
|
| 276 |
```
|
|
|
|
| 329 |
constexpr basic_string& insert(size_type pos, const charT* s, size_type n);
|
| 330 |
```
|
| 331 |
|
| 332 |
*Preconditions:* \[`s`, `s + n`) is a valid range.
|
| 333 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
*Effects:* Inserts a copy of the range \[`s`, `s + n`) immediately
|
| 335 |
before the character at position `pos` if `pos < size()`, or otherwise
|
| 336 |
at the end of the string.
|
| 337 |
|
| 338 |
*Returns:* `*this`.
|
| 339 |
|
| 340 |
+
*Throws:*
|
| 341 |
+
|
| 342 |
+
- `out_of_range` if `pos > size()`,
|
| 343 |
+
- `length_error` if `n > max_size() - size()`, or
|
| 344 |
+
- any exceptions thrown by `allocator_traits<Allocator>::allocate`.
|
| 345 |
+
|
| 346 |
``` cpp
|
| 347 |
constexpr basic_string& insert(size_type pos, const charT* s);
|
| 348 |
```
|
| 349 |
|
| 350 |
*Effects:* Equivalent to: `return insert(pos, s, traits::length(s));`
|
|
|
|
| 399 |
`insert(p - begin(), basic_string(first, last, get_allocator()))`.
|
| 400 |
|
| 401 |
*Returns:* An iterator which refers to the first inserted character, or
|
| 402 |
`p` if `first == last`.
|
| 403 |
|
| 404 |
+
``` cpp
|
| 405 |
+
template<container-compatible-range<charT> R>
|
| 406 |
+
constexpr iterator insert_range(const_iterator p, R&& rg);
|
| 407 |
+
```
|
| 408 |
+
|
| 409 |
+
*Preconditions:* `p` is a valid iterator on `*this`.
|
| 410 |
+
|
| 411 |
+
*Effects:* Equivalent to
|
| 412 |
+
`insert(p - begin(), basic_string(from_range, std::forward<R>(rg), get_allocator()))`.
|
| 413 |
+
|
| 414 |
+
*Returns:* An iterator which refers to the first inserted character, or
|
| 415 |
+
`p` if `rg` is empty.
|
| 416 |
+
|
| 417 |
``` cpp
|
| 418 |
constexpr iterator insert(const_iterator p, initializer_list<charT> il);
|
| 419 |
```
|
| 420 |
|
| 421 |
*Effects:* Equivalent to: `return insert(p, il.begin(), il.end());`
|
|
|
|
| 424 |
|
| 425 |
``` cpp
|
| 426 |
constexpr basic_string& erase(size_type pos = 0, size_type n = npos);
|
| 427 |
```
|
| 428 |
|
|
|
|
|
|
|
| 429 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 430 |
removed as the smaller of `n` and `size() - pos`. Removes the characters
|
| 431 |
in the range \[`begin() + pos`, `begin() + pos + xlen`).
|
| 432 |
|
| 433 |
*Returns:* `*this`.
|
| 434 |
|
| 435 |
+
*Throws:* `out_of_range` if `pos` `> size()`.
|
| 436 |
+
|
| 437 |
``` cpp
|
| 438 |
constexpr iterator erase(const_iterator p);
|
| 439 |
```
|
| 440 |
|
| 441 |
*Preconditions:* `p` is a valid dereferenceable iterator on `*this`.
|
| 442 |
|
|
|
|
|
|
|
| 443 |
*Effects:* Removes the character referred to by `p`.
|
| 444 |
|
| 445 |
*Returns:* An iterator which points to the element immediately following
|
| 446 |
`p` prior to the element being erased. If no such element exists,
|
| 447 |
`end()` is returned.
|
| 448 |
|
| 449 |
+
*Throws:* Nothing.
|
| 450 |
+
|
| 451 |
``` cpp
|
| 452 |
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 453 |
```
|
| 454 |
|
| 455 |
*Preconditions:* `first` and `last` are valid iterators on `*this`.
|
| 456 |
\[`first`, `last`) is a valid range.
|
| 457 |
|
|
|
|
|
|
|
| 458 |
*Effects:* Removes the characters in the range `[first, last)`.
|
| 459 |
|
| 460 |
*Returns:* An iterator which points to the element pointed to by `last`
|
| 461 |
prior to the other elements being erased. If no such element exists,
|
| 462 |
`end()` is returned.
|
| 463 |
|
| 464 |
+
*Throws:* Nothing.
|
| 465 |
+
|
| 466 |
``` cpp
|
| 467 |
constexpr void pop_back();
|
| 468 |
```
|
| 469 |
|
| 470 |
*Preconditions:* `!empty()`.
|
| 471 |
|
|
|
|
|
|
|
| 472 |
*Effects:* Equivalent to `erase(end() - 1)`.
|
| 473 |
|
| 474 |
+
*Throws:* Nothing.
|
| 475 |
+
|
| 476 |
##### `basic_string::replace` <a id="string.replace">[[string.replace]]</a>
|
| 477 |
|
| 478 |
``` cpp
|
| 479 |
constexpr basic_string& replace(size_type pos1, size_type n1, const basic_string& str);
|
| 480 |
```
|
|
|
|
| 534 |
constexpr basic_string& replace(size_type pos1, size_type n1, const charT* s, size_type n2);
|
| 535 |
```
|
| 536 |
|
| 537 |
*Preconditions:* \[`s`, `s + n2`) is a valid range.
|
| 538 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 539 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 540 |
removed as the smaller of `n1` and `size() - pos1`. If
|
| 541 |
`size() - xlen >= max_size() - n2` throws `length_error`. Otherwise, the
|
| 542 |
function replaces the characters in the range \[`begin() + pos1`,
|
| 543 |
`begin() + pos1 + xlen`) with a copy of the range \[`s`, `s + n2`).
|
| 544 |
|
| 545 |
*Returns:* `*this`.
|
| 546 |
|
| 547 |
+
*Throws:*
|
| 548 |
+
|
| 549 |
+
- `out_of_range` if `pos1 > size()`,
|
| 550 |
+
- `length_error` if the length of the resulting string would exceed
|
| 551 |
+
`max_size()`, or
|
| 552 |
+
- any exceptions thrown by `allocator_traits<Allocator>::allocate`.
|
| 553 |
+
|
| 554 |
``` cpp
|
| 555 |
constexpr basic_string& replace(size_type pos, size_type n, const charT* s);
|
| 556 |
```
|
| 557 |
|
| 558 |
*Effects:* Equivalent to:
|
|
|
|
| 560 |
|
| 561 |
``` cpp
|
| 562 |
constexpr basic_string& replace(size_type pos1, size_type n1, size_type n2, charT c);
|
| 563 |
```
|
| 564 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
*Effects:* Determines the effective length `xlen` of the string to be
|
| 566 |
removed as the smaller of `n1` and `size() - pos1`. If
|
| 567 |
`size() - xlen >=` `max_size() - n2` throws `length_error`. Otherwise,
|
| 568 |
the function replaces the characters in the range \[`begin() + pos1`,
|
| 569 |
`begin() + pos1 + xlen`) with `n2` copies of `c`.
|
| 570 |
|
| 571 |
*Returns:* `*this`.
|
| 572 |
|
| 573 |
+
*Throws:*
|
| 574 |
+
|
| 575 |
+
- `out_of_range` if `pos1 > size()`,
|
| 576 |
+
- `length_error` if the length of the resulting string would
|
| 577 |
+
exceed`max_size()`, or
|
| 578 |
+
- any exceptions thrown by `allocator_traits<Allocator>::allocate.`
|
| 579 |
+
|
| 580 |
``` cpp
|
| 581 |
constexpr basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
|
| 582 |
```
|
| 583 |
|
| 584 |
*Effects:* Equivalent to:
|
|
|
|
| 636 |
iterator [[container.requirements.general]].
|
| 637 |
|
| 638 |
*Effects:* Equivalent to:
|
| 639 |
`return replace(i1, i2, basic_string(j1, j2, get_allocator()));`
|
| 640 |
|
| 641 |
+
``` cpp
|
| 642 |
+
template<container-compatible-range<charT> R>
|
| 643 |
+
constexpr basic_string& replace_with_range(const_iterator i1, const_iterator i2, R&& rg);
|
| 644 |
+
```
|
| 645 |
+
|
| 646 |
+
*Effects:* Equivalent to:
|
| 647 |
+
|
| 648 |
+
``` cpp
|
| 649 |
+
return replace(i1, i2, basic_string(from_range, std::forward<R>(rg), get_allocator()));
|
| 650 |
+
```
|
| 651 |
+
|
| 652 |
``` cpp
|
| 653 |
constexpr basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<charT> il);
|
| 654 |
```
|
| 655 |
|
| 656 |
*Effects:* Equivalent to:
|