tmp/tmpdkhd60iv/{from.md → to.md}
RENAMED
|
@@ -46,11 +46,11 @@ basic_string&
|
|
| 46 |
|
| 47 |
*Returns:* `*this`.
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
basic_string&
|
| 51 |
-
append(const basic_string& str, size_type pos, size_type n);
|
| 52 |
```
|
| 53 |
|
| 54 |
*Requires:* `pos <= str.size()`
|
| 55 |
|
| 56 |
*Throws:* `out_of_range` if `pos > str.size()`.
|
|
@@ -114,11 +114,11 @@ basic_string& append(initializer_list<charT> il);
|
|
| 114 |
*Effects:* Calls `append(il.begin(), il.size())`.
|
| 115 |
|
| 116 |
*Returns:* `*this`.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
-
void push_back(charT c)
|
| 120 |
```
|
| 121 |
|
| 122 |
*Effects:* Equivalent to `append(static_cast<size_type>(1), c)`.
|
| 123 |
|
| 124 |
#### `basic_string::assign` <a id="string::assign">[[string::assign]]</a>
|
|
@@ -142,11 +142,11 @@ controlled by `str`. A valid implementation is `swap(str)`.
|
|
| 142 |
*Returns:* `*this`.
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
basic_string&
|
| 146 |
assign(const basic_string& str, size_type pos,
|
| 147 |
-
size_type n);
|
| 148 |
```
|
| 149 |
|
| 150 |
*Requires:* `pos <= str.size()`
|
| 151 |
|
| 152 |
*Throws:* `out_of_range` if `pos > str.size()`.
|
|
@@ -224,11 +224,11 @@ basic_string&
|
|
| 224 |
|
| 225 |
``` cpp
|
| 226 |
basic_string&
|
| 227 |
insert(size_type pos1,
|
| 228 |
const basic_string& str,
|
| 229 |
-
size_type pos2, size_type n);
|
| 230 |
```
|
| 231 |
|
| 232 |
*Requires:* `pos1 <= size()` and `pos2 <= str.size()`
|
| 233 |
|
| 234 |
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
|
|
@@ -328,12 +328,11 @@ iterator insert(const_iterator p, initializer_list<charT> il);
|
|
| 328 |
character, or `p` if `i1` is empty.
|
| 329 |
|
| 330 |
#### `basic_string::erase` <a id="string::erase">[[string::erase]]</a>
|
| 331 |
|
| 332 |
``` cpp
|
| 333 |
-
basic_string
|
| 334 |
-
erase(size_type pos = 0, size_type n = npos);
|
| 335 |
```
|
| 336 |
|
| 337 |
*Requires:* `pos` ` <= size()`
|
| 338 |
|
| 339 |
*Throws:* `out_of_range` if `pos` `> size()`.
|
|
@@ -351,10 +350,12 @@ string controlled by `*this` beginning at position `pos + xlen`.
|
|
| 351 |
|
| 352 |
``` cpp
|
| 353 |
iterator erase(const_iterator p);
|
| 354 |
```
|
| 355 |
|
|
|
|
|
|
|
| 356 |
*Effects:* removes the character referred to by `p`.
|
| 357 |
|
| 358 |
*Returns:* An iterator which points to the element immediately following
|
| 359 |
`p` prior to the element being erased. If no such element exists,
|
| 360 |
`end()` is returned.
|
|
@@ -364,10 +365,12 @@ iterator erase(const_iterator first, const_iterator last);
|
|
| 364 |
```
|
| 365 |
|
| 366 |
*Requires:* `first` and `last` are valid iterators on `*this`, defining
|
| 367 |
a range `[first,last)`.
|
| 368 |
|
|
|
|
|
|
|
| 369 |
*Effects:* removes the characters in the range `[first,last)`.
|
| 370 |
|
| 371 |
*Returns:* An iterator which points to the element pointed to by `last`
|
| 372 |
prior to the other elements being erased. If no such element exists,
|
| 373 |
`end()` is returned.
|
|
@@ -376,10 +379,12 @@ prior to the other elements being erased. If no such element exists,
|
|
| 376 |
void pop_back();
|
| 377 |
```
|
| 378 |
|
| 379 |
*Requires:* `!empty()`
|
| 380 |
|
|
|
|
|
|
|
| 381 |
*Effects:* Equivalent to `erase(size() - 1, 1)`.
|
| 382 |
|
| 383 |
#### `basic_string::replace` <a id="string::replace">[[string::replace]]</a>
|
| 384 |
|
| 385 |
``` cpp
|
|
@@ -398,11 +403,11 @@ basic_string&
|
|
| 398 |
|
| 399 |
``` cpp
|
| 400 |
basic_string&
|
| 401 |
replace(size_type pos1, size_type n1,
|
| 402 |
const basic_string& str,
|
| 403 |
-
size_type pos2, size_type n2);
|
| 404 |
```
|
| 405 |
|
| 406 |
*Requires:* `pos1 <= size()` and `pos2 <= str.size()`.
|
| 407 |
|
| 408 |
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
|
|
@@ -524,11 +529,11 @@ basic_string& replace(const_iterator i1, const_iterator i2,
|
|
| 524 |
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 525 |
|
| 526 |
*Effects:* Calls
|
| 527 |
`replace(i1 - begin(), i2 - i1, il.begin(), il.size())`.
|
| 528 |
|
| 529 |
-
`*this`.
|
| 530 |
|
| 531 |
#### `basic_string::copy` <a id="string::copy">[[string::copy]]</a>
|
| 532 |
|
| 533 |
``` cpp
|
| 534 |
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
|
@@ -552,15 +557,15 @@ The function does not append a null object to the string designated by
|
|
| 552 |
*Returns:* `rlen`.
|
| 553 |
|
| 554 |
#### `basic_string::swap` <a id="string::swap">[[string::swap]]</a>
|
| 555 |
|
| 556 |
``` cpp
|
| 557 |
-
void swap(basic_string
|
| 558 |
```
|
| 559 |
|
| 560 |
`*this` contains the same sequence of characters that was in `s`, `s`
|
| 561 |
contains the same sequence of characters that was in `*this`.
|
| 562 |
|
| 563 |
*Throws:* Nothing.
|
| 564 |
|
| 565 |
-
*Complexity:*
|
| 566 |
|
|
|
|
| 46 |
|
| 47 |
*Returns:* `*this`.
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
basic_string&
|
| 51 |
+
append(const basic_string& str, size_type pos, size_type n = npos);
|
| 52 |
```
|
| 53 |
|
| 54 |
*Requires:* `pos <= str.size()`
|
| 55 |
|
| 56 |
*Throws:* `out_of_range` if `pos > str.size()`.
|
|
|
|
| 114 |
*Effects:* Calls `append(il.begin(), il.size())`.
|
| 115 |
|
| 116 |
*Returns:* `*this`.
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
+
void push_back(charT c);
|
| 120 |
```
|
| 121 |
|
| 122 |
*Effects:* Equivalent to `append(static_cast<size_type>(1), c)`.
|
| 123 |
|
| 124 |
#### `basic_string::assign` <a id="string::assign">[[string::assign]]</a>
|
|
|
|
| 142 |
*Returns:* `*this`.
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
basic_string&
|
| 146 |
assign(const basic_string& str, size_type pos,
|
| 147 |
+
size_type n = npos);
|
| 148 |
```
|
| 149 |
|
| 150 |
*Requires:* `pos <= str.size()`
|
| 151 |
|
| 152 |
*Throws:* `out_of_range` if `pos > str.size()`.
|
|
|
|
| 224 |
|
| 225 |
``` cpp
|
| 226 |
basic_string&
|
| 227 |
insert(size_type pos1,
|
| 228 |
const basic_string& str,
|
| 229 |
+
size_type pos2, size_type n = npos);
|
| 230 |
```
|
| 231 |
|
| 232 |
*Requires:* `pos1 <= size()` and `pos2 <= str.size()`
|
| 233 |
|
| 234 |
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
|
|
|
|
| 328 |
character, or `p` if `i1` is empty.
|
| 329 |
|
| 330 |
#### `basic_string::erase` <a id="string::erase">[[string::erase]]</a>
|
| 331 |
|
| 332 |
``` cpp
|
| 333 |
+
basic_string& erase(size_type pos = 0, size_type n = npos);
|
|
|
|
| 334 |
```
|
| 335 |
|
| 336 |
*Requires:* `pos` ` <= size()`
|
| 337 |
|
| 338 |
*Throws:* `out_of_range` if `pos` `> size()`.
|
|
|
|
| 350 |
|
| 351 |
``` cpp
|
| 352 |
iterator erase(const_iterator p);
|
| 353 |
```
|
| 354 |
|
| 355 |
+
*Throws:* Nothing.
|
| 356 |
+
|
| 357 |
*Effects:* removes the character referred to by `p`.
|
| 358 |
|
| 359 |
*Returns:* An iterator which points to the element immediately following
|
| 360 |
`p` prior to the element being erased. If no such element exists,
|
| 361 |
`end()` is returned.
|
|
|
|
| 365 |
```
|
| 366 |
|
| 367 |
*Requires:* `first` and `last` are valid iterators on `*this`, defining
|
| 368 |
a range `[first,last)`.
|
| 369 |
|
| 370 |
+
*Throws:* Nothing.
|
| 371 |
+
|
| 372 |
*Effects:* removes the characters in the range `[first,last)`.
|
| 373 |
|
| 374 |
*Returns:* An iterator which points to the element pointed to by `last`
|
| 375 |
prior to the other elements being erased. If no such element exists,
|
| 376 |
`end()` is returned.
|
|
|
|
| 379 |
void pop_back();
|
| 380 |
```
|
| 381 |
|
| 382 |
*Requires:* `!empty()`
|
| 383 |
|
| 384 |
+
*Throws:* Nothing.
|
| 385 |
+
|
| 386 |
*Effects:* Equivalent to `erase(size() - 1, 1)`.
|
| 387 |
|
| 388 |
#### `basic_string::replace` <a id="string::replace">[[string::replace]]</a>
|
| 389 |
|
| 390 |
``` cpp
|
|
|
|
| 403 |
|
| 404 |
``` cpp
|
| 405 |
basic_string&
|
| 406 |
replace(size_type pos1, size_type n1,
|
| 407 |
const basic_string& str,
|
| 408 |
+
size_type pos2, size_type n2 = npos);
|
| 409 |
```
|
| 410 |
|
| 411 |
*Requires:* `pos1 <= size()` and `pos2 <= str.size()`.
|
| 412 |
|
| 413 |
*Throws:* `out_of_range` if `pos1 > size()` or `pos2 > str.size()`.
|
|
|
|
| 529 |
*Requires:* \[`begin()`, `i1`) and \[`i1`, `i2`) are valid ranges.
|
| 530 |
|
| 531 |
*Effects:* Calls
|
| 532 |
`replace(i1 - begin(), i2 - i1, il.begin(), il.size())`.
|
| 533 |
|
| 534 |
+
*Returns:* `*this`.
|
| 535 |
|
| 536 |
#### `basic_string::copy` <a id="string::copy">[[string::copy]]</a>
|
| 537 |
|
| 538 |
``` cpp
|
| 539 |
size_type copy(charT* s, size_type n, size_type pos = 0) const;
|
|
|
|
| 557 |
*Returns:* `rlen`.
|
| 558 |
|
| 559 |
#### `basic_string::swap` <a id="string::swap">[[string::swap]]</a>
|
| 560 |
|
| 561 |
``` cpp
|
| 562 |
+
void swap(basic_string& s);
|
| 563 |
```
|
| 564 |
|
| 565 |
`*this` contains the same sequence of characters that was in `s`, `s`
|
| 566 |
contains the same sequence of characters that was in `*this`.
|
| 567 |
|
| 568 |
*Throws:* Nothing.
|
| 569 |
|
| 570 |
+
*Complexity:* Constant time.
|
| 571 |
|