From Jason Turner

[map.erasure]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_btmq_p9/{from.md → to.md} +22 -0
tmp/tmp_btmq_p9/{from.md → to.md} RENAMED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Erasure <a id="map.erasure">[[map.erasure]]</a>
2
+
3
+ ``` cpp
4
+ template<class Key, class T, class Compare, class Allocator, class Predicate>
5
+ typename map<Key, T, Compare, Allocator>::size_type
6
+ erase_if(map<Key, T, Compare, Allocator>& c, Predicate pred);
7
+ ```
8
+
9
+ *Effects:* Equivalent to:
10
+
11
+ ``` cpp
12
+ auto original_size = c.size();
13
+ for (auto i = c.begin(), last = c.end(); i != last; ) {
14
+ if (pred(*i)) {
15
+ i = c.erase(i);
16
+ } else {
17
+ ++i;
18
+ }
19
+ }
20
+ return original_size - c.size();
21
+ ```
22
+