tmp/tmpne4aidn8/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Erasure <a id="vector.erasure">[[vector.erasure]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
template<class T, class Allocator, class U>
|
| 5 |
+
constexpr typename vector<T, Allocator>::size_type
|
| 6 |
+
erase(vector<T, Allocator>& c, const U& value);
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
*Effects:* Equivalent to:
|
| 10 |
+
|
| 11 |
+
``` cpp
|
| 12 |
+
auto it = remove(c.begin(), c.end(), value);
|
| 13 |
+
auto r = distance(it, c.end());
|
| 14 |
+
c.erase(it, c.end());
|
| 15 |
+
return r;
|
| 16 |
+
```
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
template<class T, class Allocator, class Predicate>
|
| 20 |
+
constexpr typename vector<T, Allocator>::size_type
|
| 21 |
+
erase_if(vector<T, Allocator>& c, Predicate pred);
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
*Effects:* Equivalent to:
|
| 25 |
+
|
| 26 |
+
``` cpp
|
| 27 |
+
auto it = remove_if(c.begin(), c.end(), pred);
|
| 28 |
+
auto r = distance(it, c.end());
|
| 29 |
+
c.erase(it, c.end());
|
| 30 |
+
return r;
|
| 31 |
+
```
|
| 32 |
+
|