From Jason Turner

[string.erase]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmprv5g_519/{from.md → to.md} +12 -15
tmp/tmprv5g_519/{from.md → to.md} RENAMED
@@ -1,56 +1,53 @@
1
  ##### `basic_string::erase` <a id="string.erase">[[string.erase]]</a>
2
 
3
  ``` cpp
4
- basic_string& erase(size_type pos = 0, size_type n = npos);
5
  ```
6
 
7
  *Throws:* `out_of_range` if `pos` `> size()`.
8
 
9
  *Effects:* Determines the effective length `xlen` of the string to be
10
- removed as the smaller of `n` and `size() - pos`.
11
-
12
- The function then replaces the string controlled by `*this` with a
13
- string of length `size() - xlen` whose first `pos` elements are a copy
14
- of the initial elements of the original string controlled by `*this`,
15
- and whose remaining elements are a copy of the elements of the original
16
- string controlled by `*this` beginning at position `pos + xlen`.
17
 
18
  *Returns:* `*this`.
19
 
20
  ``` cpp
21
- iterator erase(const_iterator p);
22
  ```
23
 
 
 
24
  *Throws:* Nothing.
25
 
26
  *Effects:* Removes the character referred to by `p`.
27
 
28
  *Returns:* An iterator which points to the element immediately following
29
  `p` prior to the element being erased. If no such element exists,
30
  `end()` is returned.
31
 
32
  ``` cpp
33
- iterator erase(const_iterator first, const_iterator last);
34
  ```
35
 
36
- *Requires:* `first` and `last` are valid iterators on `*this`, defining
37
- a range `[first, last)`.
38
 
39
  *Throws:* Nothing.
40
 
41
  *Effects:* Removes the characters in the range `[first, last)`.
42
 
43
  *Returns:* An iterator which points to the element pointed to by `last`
44
  prior to the other elements being erased. If no such element exists,
45
  `end()` is returned.
46
 
47
  ``` cpp
48
- void pop_back();
49
  ```
50
 
51
- *Requires:* `!empty()`.
52
 
53
  *Throws:* Nothing.
54
 
55
- *Effects:* Equivalent to `erase(size() - 1, 1)`.
56
 
 
1
  ##### `basic_string::erase` <a id="string.erase">[[string.erase]]</a>
2
 
3
  ``` cpp
4
+ constexpr basic_string& erase(size_type pos = 0, size_type n = npos);
5
  ```
6
 
7
  *Throws:* `out_of_range` if `pos` `> size()`.
8
 
9
  *Effects:* Determines the effective length `xlen` of the string to be
10
+ removed as the smaller of `n` and `size() - pos`. Removes the characters
11
+ in the range \[`begin() + pos`, `begin() + pos + xlen`).
 
 
 
 
 
12
 
13
  *Returns:* `*this`.
14
 
15
  ``` cpp
16
+ constexpr iterator erase(const_iterator p);
17
  ```
18
 
19
+ *Preconditions:* `p` is a valid dereferenceable iterator on `*this`.
20
+
21
  *Throws:* Nothing.
22
 
23
  *Effects:* Removes the character referred to by `p`.
24
 
25
  *Returns:* An iterator which points to the element immediately following
26
  `p` prior to the element being erased. If no such element exists,
27
  `end()` is returned.
28
 
29
  ``` cpp
30
+ constexpr iterator erase(const_iterator first, const_iterator last);
31
  ```
32
 
33
+ *Preconditions:* `first` and `last` are valid iterators on `*this`.
34
+ \[`first`, `last`) is a valid range.
35
 
36
  *Throws:* Nothing.
37
 
38
  *Effects:* Removes the characters in the range `[first, last)`.
39
 
40
  *Returns:* An iterator which points to the element pointed to by `last`
41
  prior to the other elements being erased. If no such element exists,
42
  `end()` is returned.
43
 
44
  ``` cpp
45
+ constexpr void pop_back();
46
  ```
47
 
48
+ *Preconditions:* `!empty()`.
49
 
50
  *Throws:* Nothing.
51
 
52
+ *Effects:* Equivalent to `erase(end() - 1)`.
53