From Jason Turner

[multimap]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpp529hm_1/{from.md → to.md} +99 -98
tmp/tmpp529hm_1/{from.md → to.md} RENAMED
@@ -18,10 +18,13 @@ not the `a_uniq` operations. For a `multimap<Key,T>` the `key_type` is
18
  `Key` and the `value_type` is `pair<const Key,T>`. Descriptions are
19
  provided here only for operations on `multimap` that are not described
20
  in one of those tables or for operations where there is additional
21
  semantic information.
22
 
 
 
 
23
  ``` cpp
24
  namespace std {
25
  template<class Key, class T, class Compare = less<Key>,
26
  class Allocator = allocator<pair<const Key, T>>>
27
  class multimap {
@@ -30,12 +33,12 @@ namespace std {
30
  using key_type = Key;
31
  using mapped_type = T;
32
  using value_type = pair<const Key, T>;
33
  using key_compare = Compare;
34
  using allocator_type = Allocator;
35
- using pointer = typename allocator_traits<Allocator>::pointer;
36
- using const_pointer = typename allocator_traits<Allocator>::const_pointer;
37
  using reference = value_type&;
38
  using const_reference = const value_type&;
39
  using size_type = implementation-defined // type of multimap::size_type; // see [container.requirements]
40
  using difference_type = implementation-defined // type of multimap::difference_type; // see [container.requirements]
41
  using iterator = implementation-defined // type of multimap::iterator; // see [container.requirements]
@@ -43,148 +46,146 @@ namespace std {
43
  using reverse_iterator = std::reverse_iterator<iterator>;
44
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
45
  using node_type = unspecified;
46
 
47
  class value_compare {
48
- friend class multimap;
49
  protected:
50
  Compare comp;
51
- value_compare(Compare c) : comp(c) { }
52
 
53
  public:
54
- bool operator()(const value_type& x, const value_type& y) const {
55
  return comp(x.first, y.first);
56
  }
57
  };
58
 
59
  // [multimap.cons], construct/copy/destroy
60
- multimap() : multimap(Compare()) { }
61
- explicit multimap(const Compare& comp, const Allocator& = Allocator());
62
  template<class InputIterator>
63
- multimap(InputIterator first, InputIterator last,
64
- const Compare& comp = Compare(),
65
- const Allocator& = Allocator());
66
  template<container-compatible-range<value_type> R>
67
- multimap(from_range_t, R&& rg,
68
  const Compare& comp = Compare(), const Allocator& = Allocator());
69
- multimap(const multimap& x);
70
- multimap(multimap&& x);
71
- explicit multimap(const Allocator&);
72
- multimap(const multimap&, const type_identity_t<Allocator>&);
73
- multimap(multimap&&, const type_identity_t<Allocator>&);
74
- multimap(initializer_list<value_type>,
75
- const Compare& = Compare(),
76
- const Allocator& = Allocator());
77
  template<class InputIterator>
78
- multimap(InputIterator first, InputIterator last, const Allocator& a)
79
  : multimap(first, last, Compare(), a) { }
80
  template<container-compatible-range<value_type> R>
81
- multimap(from_range_t, R&& rg, const Allocator& a))
82
  : multimap(from_range, std::forward<R>(rg), Compare(), a) { }
83
- multimap(initializer_list<value_type> il, const Allocator& a)
84
  : multimap(il, Compare(), a) { }
85
- ~multimap();
86
- multimap& operator=(const multimap& x);
87
- multimap& operator=(multimap&& x)
88
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
89
  is_nothrow_move_assignable_v<Compare>);
90
- multimap& operator=(initializer_list<value_type>);
91
- allocator_type get_allocator() const noexcept;
92
 
93
  // iterators
94
- iterator begin() noexcept;
95
- const_iterator begin() const noexcept;
96
- iterator end() noexcept;
97
- const_iterator end() const noexcept;
98
 
99
- reverse_iterator rbegin() noexcept;
100
- const_reverse_iterator rbegin() const noexcept;
101
- reverse_iterator rend() noexcept;
102
- const_reverse_iterator rend() const noexcept;
103
 
104
- const_iterator cbegin() const noexcept;
105
- const_iterator cend() const noexcept;
106
- const_reverse_iterator crbegin() const noexcept;
107
- const_reverse_iterator crend() const noexcept;
108
 
109
  // capacity
110
- [[nodiscard]] bool empty() const noexcept;
111
- size_type size() const noexcept;
112
- size_type max_size() const noexcept;
113
 
114
  // [multimap.modifiers], modifiers
115
- template<class... Args> iterator emplace(Args&&... args);
116
- template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
117
- iterator insert(const value_type& x);
118
- iterator insert(value_type&& x);
119
- template<class P> iterator insert(P&& x);
120
- iterator insert(const_iterator position, const value_type& x);
121
- iterator insert(const_iterator position, value_type&& x);
122
- template<class P> iterator insert(const_iterator position, P&& x);
 
123
  template<class InputIterator>
124
- void insert(InputIterator first, InputIterator last);
125
  template<container-compatible-range<value_type> R>
126
- void insert_range(R&& rg);
127
- void insert(initializer_list<value_type>);
128
 
129
- node_type extract(const_iterator position);
130
- node_type extract(const key_type& x);
131
  template<class K> node_type extract(K&& x);
132
- iterator insert(node_type&& nh);
133
- iterator insert(const_iterator hint, node_type&& nh);
134
 
135
- iterator erase(iterator position);
136
- iterator erase(const_iterator position);
137
- size_type erase(const key_type& x);
138
- template<class K> size_type erase(K&& x);
139
- iterator erase(const_iterator first, const_iterator last);
140
- void swap(multimap&)
141
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
142
  is_nothrow_swappable_v<Compare>);
143
- void clear() noexcept;
144
 
145
  template<class C2>
146
- void merge(multimap<Key, T, C2, Allocator>& source);
147
  template<class C2>
148
- void merge(multimap<Key, T, C2, Allocator>&& source);
149
  template<class C2>
150
- void merge(map<Key, T, C2, Allocator>& source);
151
  template<class C2>
152
- void merge(map<Key, T, C2, Allocator>&& source);
153
 
154
  // observers
155
- key_compare key_comp() const;
156
- value_compare value_comp() const;
157
 
158
  // map operations
159
- iterator find(const key_type& x);
160
- const_iterator find(const key_type& x) const;
161
- template<class K> iterator find(const K& x);
162
- template<class K> const_iterator find(const K& x) const;
163
 
164
- size_type count(const key_type& x) const;
165
- template<class K> size_type count(const K& x) const;
166
 
167
- bool contains(const key_type& x) const;
168
- template<class K> bool contains(const K& x) const;
169
 
170
- iterator lower_bound(const key_type& x);
171
- const_iterator lower_bound(const key_type& x) const;
172
- template<class K> iterator lower_bound(const K& x);
173
- template<class K> const_iterator lower_bound(const K& x) const;
174
 
175
- iterator upper_bound(const key_type& x);
176
- const_iterator upper_bound(const key_type& x) const;
177
- template<class K> iterator upper_bound(const K& x);
178
- template<class K> const_iterator upper_bound(const K& x) const;
179
 
180
- pair<iterator, iterator> equal_range(const key_type& x);
181
- pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
182
  template<class K>
183
- pair<iterator, iterator> equal_range(const K& x);
184
  template<class K>
185
- pair<const_iterator, const_iterator> equal_range(const K& x) const;
186
  };
187
 
188
  template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>,
189
  class Allocator = allocator<iter-to-alloc-type<InputIterator>>>
190
  multimap(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
@@ -217,23 +218,22 @@ namespace std {
217
  ```
218
 
219
  #### Constructors <a id="multimap.cons">[[multimap.cons]]</a>
220
 
221
  ``` cpp
222
- explicit multimap(const Compare& comp, const Allocator& = Allocator());
223
  ```
224
 
225
  *Effects:* Constructs an empty `multimap` using the specified comparison
226
  object and allocator.
227
 
228
  *Complexity:* Constant.
229
 
230
  ``` cpp
231
  template<class InputIterator>
232
- multimap(InputIterator first, InputIterator last,
233
- const Compare& comp = Compare(),
234
- const Allocator& = Allocator());
235
  ```
236
 
237
  *Effects:* Constructs an empty `multimap` using the specified comparison
238
  object and allocator, and inserts elements from the range \[`first`,
239
  `last`).
@@ -242,11 +242,12 @@ object and allocator, and inserts elements from the range \[`first`,
242
  sorted with respect to `comp` and otherwise N log N, where N is
243
  `last - first`.
244
 
245
  ``` cpp
246
  template<container-compatible-range<value_type> R>
247
- multimap(from_range_t, R&& rg, const Compare& comp = Compare(), const Allocator& = Allocator());
 
248
  ```
249
 
250
  *Effects:* Constructs an empty `multimap` using the specified comparison
251
  object and allocator, and inserts elements from the range `rg`.
252
 
@@ -254,12 +255,12 @@ object and allocator, and inserts elements from the range `rg`.
254
  `comp` and otherwise N log N, where N is `ranges::distance(rg)`.
255
 
256
  #### Modifiers <a id="multimap.modifiers">[[multimap.modifiers]]</a>
257
 
258
  ``` cpp
259
- template<class P> iterator insert(P&& x);
260
- template<class P> iterator insert(const_iterator position, P&& x);
261
  ```
262
 
263
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
264
 
265
  *Effects:* The first form is equivalent to
@@ -269,11 +270,11 @@ template<class P> iterator insert(const_iterator position, P&& x);
269
  #### Erasure <a id="multimap.erasure">[[multimap.erasure]]</a>
270
 
271
  ``` cpp
272
  template<class Key, class T, class Compare, class Allocator, class Predicate>
273
  typename multimap<Key, T, Compare, Allocator>::size_type
274
- erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);
275
  ```
276
 
277
  *Effects:* Equivalent to:
278
 
279
  ``` cpp
 
18
  `Key` and the `value_type` is `pair<const Key,T>`. Descriptions are
19
  provided here only for operations on `multimap` that are not described
20
  in one of those tables or for operations where there is additional
21
  semantic information.
22
 
23
+ The types `iterator` and `const_iterator` meet the constexpr iterator
24
+ requirements [[iterator.requirements.general]].
25
+
26
  ``` cpp
27
  namespace std {
28
  template<class Key, class T, class Compare = less<Key>,
29
  class Allocator = allocator<pair<const Key, T>>>
30
  class multimap {
 
33
  using key_type = Key;
34
  using mapped_type = T;
35
  using value_type = pair<const Key, T>;
36
  using key_compare = Compare;
37
  using allocator_type = Allocator;
38
+ using pointer = allocator_traits<Allocator>::pointer;
39
+ using const_pointer = allocator_traits<Allocator>::const_pointer;
40
  using reference = value_type&;
41
  using const_reference = const value_type&;
42
  using size_type = implementation-defined // type of multimap::size_type; // see [container.requirements]
43
  using difference_type = implementation-defined // type of multimap::difference_type; // see [container.requirements]
44
  using iterator = implementation-defined // type of multimap::iterator; // see [container.requirements]
 
46
  using reverse_iterator = std::reverse_iterator<iterator>;
47
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
48
  using node_type = unspecified;
49
 
50
  class value_compare {
 
51
  protected:
52
  Compare comp;
53
+ constexpr value_compare(Compare c) : comp(c) { }
54
 
55
  public:
56
+ constexpr bool operator()(const value_type& x, const value_type& y) const {
57
  return comp(x.first, y.first);
58
  }
59
  };
60
 
61
  // [multimap.cons], construct/copy/destroy
62
+ constexpr multimap() : multimap(Compare()) { }
63
+ constexpr explicit multimap(const Compare& comp, const Allocator& = Allocator());
64
  template<class InputIterator>
65
+ constexpr multimap(InputIterator first, InputIterator last,
66
+ const Compare& comp = Compare(), const Allocator& = Allocator());
 
67
  template<container-compatible-range<value_type> R>
68
+ constexpr multimap(from_range_t, R&& rg,
69
  const Compare& comp = Compare(), const Allocator& = Allocator());
70
+ constexpr multimap(const multimap& x);
71
+ constexpr multimap(multimap&& x);
72
+ constexpr explicit multimap(const Allocator&);
73
+ constexpr multimap(const multimap&, const type_identity_t<Allocator>&);
74
+ constexpr multimap(multimap&&, const type_identity_t<Allocator>&);
75
+ constexpr multimap(initializer_list<value_type>,
76
+ const Compare& = Compare(), const Allocator& = Allocator());
 
77
  template<class InputIterator>
78
+ constexpr multimap(InputIterator first, InputIterator last, const Allocator& a)
79
  : multimap(first, last, Compare(), a) { }
80
  template<container-compatible-range<value_type> R>
81
+ constexpr multimap(from_range_t, R&& rg, const Allocator& a)
82
  : multimap(from_range, std::forward<R>(rg), Compare(), a) { }
83
+ constexpr multimap(initializer_list<value_type> il, const Allocator& a)
84
  : multimap(il, Compare(), a) { }
85
+ constexpr ~multimap();
86
+ constexpr multimap& operator=(const multimap& x);
87
+ constexpr multimap& operator=(multimap&& x)
88
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
89
  is_nothrow_move_assignable_v<Compare>);
90
+ constexpr multimap& operator=(initializer_list<value_type>);
91
+ constexpr allocator_type get_allocator() const noexcept;
92
 
93
  // iterators
94
+ constexpr iterator begin() noexcept;
95
+ constexpr const_iterator begin() const noexcept;
96
+ constexpr iterator end() noexcept;
97
+ constexpr const_iterator end() const noexcept;
98
 
99
+ constexpr reverse_iterator rbegin() noexcept;
100
+ constexpr const_reverse_iterator rbegin() const noexcept;
101
+ constexpr reverse_iterator rend() noexcept;
102
+ constexpr const_reverse_iterator rend() const noexcept;
103
 
104
+ constexpr const_iterator cbegin() const noexcept;
105
+ constexpr const_iterator cend() const noexcept;
106
+ constexpr const_reverse_iterator crbegin() const noexcept;
107
+ constexpr const_reverse_iterator crend() const noexcept;
108
 
109
  // capacity
110
+ constexpr bool empty() const noexcept;
111
+ constexpr size_type size() const noexcept;
112
+ constexpr size_type max_size() const noexcept;
113
 
114
  // [multimap.modifiers], modifiers
115
+ template<class... Args> constexpr iterator emplace(Args&&... args);
116
+ template<class... Args>
117
+ constexpr iterator emplace_hint(const_iterator position, Args&&... args);
118
+ constexpr iterator insert(const value_type& x);
119
+ constexpr iterator insert(value_type&& x);
120
+ template<class P> constexpr iterator insert(P&& x);
121
+ constexpr iterator insert(const_iterator position, const value_type& x);
122
+ constexpr iterator insert(const_iterator position, value_type&& x);
123
+ template<class P> constexpr iterator insert(const_iterator position, P&& x);
124
  template<class InputIterator>
125
+ constexpr void insert(InputIterator first, InputIterator last);
126
  template<container-compatible-range<value_type> R>
127
+ constexpr void insert_range(R&& rg);
128
+ constexpr void insert(initializer_list<value_type>);
129
 
130
+ constexpr node_type extract(const_iterator position);
131
+ constexpr node_type extract(const key_type& x);
132
  template<class K> node_type extract(K&& x);
133
+ constexpr iterator insert(node_type&& nh);
134
+ constexpr iterator insert(const_iterator hint, node_type&& nh);
135
 
136
+ constexpr iterator erase(iterator position);
137
+ constexpr iterator erase(const_iterator position);
138
+ constexpr size_type erase(const key_type& x);
139
+ template<class K> constexpr size_type erase(K&& x);
140
+ constexpr iterator erase(const_iterator first, const_iterator last);
141
+ constexpr void swap(multimap&)
142
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
143
  is_nothrow_swappable_v<Compare>);
144
+ constexpr void clear() noexcept;
145
 
146
  template<class C2>
147
+ constexpr void merge(multimap<Key, T, C2, Allocator>& source);
148
  template<class C2>
149
+ constexpr void merge(multimap<Key, T, C2, Allocator>&& source);
150
  template<class C2>
151
+ constexpr void merge(map<Key, T, C2, Allocator>& source);
152
  template<class C2>
153
+ constexpr void merge(map<Key, T, C2, Allocator>&& source);
154
 
155
  // observers
156
+ constexpr key_compare key_comp() const;
157
+ constexpr value_compare value_comp() const;
158
 
159
  // map operations
160
+ constexpr iterator find(const key_type& x);
161
+ constexpr const_iterator find(const key_type& x) const;
162
+ template<class K> constexpr iterator find(const K& x);
163
+ template<class K> constexpr const_iterator find(const K& x) const;
164
 
165
+ constexpr size_type count(const key_type& x) const;
166
+ template<class K> constexpr size_type count(const K& x) const;
167
 
168
+ constexpr bool contains(const key_type& x) const;
169
+ template<class K> constexpr bool contains(const K& x) const;
170
 
171
+ constexpr iterator lower_bound(const key_type& x);
172
+ constexpr const_iterator lower_bound(const key_type& x) const;
173
+ template<class K> constexpr iterator lower_bound(const K& x);
174
+ template<class K> constexpr const_iterator lower_bound(const K& x) const;
175
 
176
+ constexpr iterator upper_bound(const key_type& x);
177
+ constexpr const_iterator upper_bound(const key_type& x) const;
178
+ template<class K> constexpr iterator upper_bound(const K& x);
179
+ template<class K> constexpr const_iterator upper_bound(const K& x) const;
180
 
181
+ constexpr pair<iterator, iterator> equal_range(const key_type& x);
182
+ constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
183
  template<class K>
184
+ constexpr pair<iterator, iterator> equal_range(const K& x);
185
  template<class K>
186
+ constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
187
  };
188
 
189
  template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>,
190
  class Allocator = allocator<iter-to-alloc-type<InputIterator>>>
191
  multimap(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
 
218
  ```
219
 
220
  #### Constructors <a id="multimap.cons">[[multimap.cons]]</a>
221
 
222
  ``` cpp
223
+ constexpr explicit multimap(const Compare& comp, const Allocator& = Allocator());
224
  ```
225
 
226
  *Effects:* Constructs an empty `multimap` using the specified comparison
227
  object and allocator.
228
 
229
  *Complexity:* Constant.
230
 
231
  ``` cpp
232
  template<class InputIterator>
233
+ constexpr multimap(InputIterator first, InputIterator last,
234
+ const Compare& comp = Compare(), const Allocator& = Allocator());
 
235
  ```
236
 
237
  *Effects:* Constructs an empty `multimap` using the specified comparison
238
  object and allocator, and inserts elements from the range \[`first`,
239
  `last`).
 
242
  sorted with respect to `comp` and otherwise N log N, where N is
243
  `last - first`.
244
 
245
  ``` cpp
246
  template<container-compatible-range<value_type> R>
247
+ constexpr multimap(from_range_t, R&& rg,
248
+ const Compare& comp = Compare(), const Allocator& = Allocator());
249
  ```
250
 
251
  *Effects:* Constructs an empty `multimap` using the specified comparison
252
  object and allocator, and inserts elements from the range `rg`.
253
 
 
255
  `comp` and otherwise N log N, where N is `ranges::distance(rg)`.
256
 
257
  #### Modifiers <a id="multimap.modifiers">[[multimap.modifiers]]</a>
258
 
259
  ``` cpp
260
+ template<class P> constexpr iterator insert(P&& x);
261
+ template<class P> constexpr iterator insert(const_iterator position, P&& x);
262
  ```
263
 
264
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
265
 
266
  *Effects:* The first form is equivalent to
 
270
  #### Erasure <a id="multimap.erasure">[[multimap.erasure]]</a>
271
 
272
  ``` cpp
273
  template<class Key, class T, class Compare, class Allocator, class Predicate>
274
  typename multimap<Key, T, Compare, Allocator>::size_type
275
+ constexpr erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate pred);
276
  ```
277
 
278
  *Effects:* Equivalent to:
279
 
280
  ``` cpp