From Jason Turner

[flat.multimap.defn]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpx681me4k/{from.md → to.md} +309 -0
tmp/tmpx681me4k/{from.md → to.md} RENAMED
@@ -0,0 +1,309 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #### Definition <a id="flat.multimap.defn">[[flat.multimap.defn]]</a>
2
+
3
+ ``` cpp
4
+ namespace std {
5
+ template<class Key, class T, class Compare = less<Key>,
6
+ class KeyContainer = vector<Key>, class MappedContainer = vector<T>>
7
+ class flat_multimap {
8
+ public:
9
+ // types
10
+ using key_type = Key;
11
+ using mapped_type = T;
12
+ using value_type = pair<key_type, mapped_type>;
13
+ using key_compare = Compare;
14
+ using reference = pair<const key_type&, mapped_type&>;
15
+ using const_reference = pair<const key_type&, const mapped_type&>;
16
+ using size_type = size_t;
17
+ using difference_type = ptrdiff_t;
18
+ using iterator = implementation-defined // type of flat_multimap::iterator; // see [container.requirements]
19
+ using const_iterator = implementation-defined // type of flat_multimap::const_iterator; // see [container.requirements]
20
+ using reverse_iterator = std::reverse_iterator<iterator>;
21
+ using const_reverse_iterator = std::reverse_iterator<const_iterator>;
22
+ using key_container_type = KeyContainer;
23
+ using mapped_container_type = MappedContainer;
24
+
25
+ class value_compare {
26
+ private:
27
+ key_compare comp; // exposition only
28
+ value_compare(key_compare c) : comp(c) { } // exposition only
29
+
30
+ public:
31
+ bool operator()(const_reference x, const_reference y) const {
32
+ return comp(x.first, y.first);
33
+ }
34
+ };
35
+
36
+ struct containers {
37
+ key_container_type keys;
38
+ mapped_container_type values;
39
+ };
40
+
41
+ // [flat.multimap.cons], construct/copy/destroy
42
+ flat_multimap() : flat_multimap(key_compare()) { }
43
+
44
+ flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont,
45
+ const key_compare& comp = key_compare());
46
+ template<class Allocator>
47
+ flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
48
+ const Allocator& a);
49
+ template<class Allocator>
50
+ flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
51
+ const key_compare& comp, const Allocator& a);
52
+
53
+ flat_multimap(sorted_equivalent_t,
54
+ key_container_type key_cont, mapped_container_type mapped_cont,
55
+ const key_compare& comp = key_compare());
56
+ template<class Allocator>
57
+ flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
58
+ const mapped_container_type& mapped_cont, const Allocator& a);
59
+ template<class Allocator>
60
+ flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
61
+ const mapped_container_type& mapped_cont,
62
+ const key_compare& comp, const Allocator& a);
63
+
64
+ explicit flat_multimap(const key_compare& comp)
65
+ : c(), compare(comp) { }
66
+ template<class Allocator>
67
+ flat_multimap(const key_compare& comp, const Allocator& a);
68
+ template<class Allocator>
69
+ explicit flat_multimap(const Allocator& a);
70
+
71
+ template<class InputIterator>
72
+ flat_multimap(InputIterator first, InputIterator last,
73
+ const key_compare& comp = key_compare())
74
+ : c(), compare(comp)
75
+ { insert(first, last); }
76
+ template<class InputIterator, class Allocator>
77
+ flat_multimap(InputIterator first, InputIterator last,
78
+ const key_compare& comp, const Allocator& a);
79
+ template<class InputIterator, class Allocator>
80
+ flat_multimap(InputIterator first, InputIterator last, const Allocator& a);
81
+
82
+ template<container-compatible-range<value_type> R>
83
+ flat_multimap(from_range_t fr, R&& rg)
84
+ : flat_multimap(fr, std::forward<R>(rg), key_compare()) { }
85
+ template<container-compatible-range<value_type> R, class Allocator>
86
+ flat_multimap(from_range_t, R&& rg, const Allocator& a);
87
+ template<container-compatible-range<value_type> R>
88
+ flat_multimap(from_range_t, R&& rg, const key_compare& comp)
89
+ : flat_multimap(comp) { insert_range(std::forward<R>(rg)); }
90
+ template<container-compatible-range<value_type> R, class Allocator>
91
+ flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
92
+
93
+ template<class InputIterator>
94
+ flat_multimap(sorted_equivalent_t s, InputIterator first, InputIterator last,
95
+ const key_compare& comp = key_compare())
96
+ : c(), compare(comp) { insert(s, first, last); }
97
+ template<class InputIterator, class Allocator>
98
+ flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
99
+ const key_compare& comp, const Allocator& a);
100
+ template<class InputIterator, class Allocator>
101
+ flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
102
+ const Allocator& a);
103
+
104
+ flat_multimap(initializer_list<value_type> il, const key_compare& comp = key_compare())
105
+ : flat_multimap(il.begin(), il.end(), comp) { }
106
+ template<class Allocator>
107
+ flat_multimap(initializer_list<value_type> il, const key_compare& comp,
108
+ const Allocator& a);
109
+ template<class Allocator>
110
+ flat_multimap(initializer_list<value_type> il, const Allocator& a);
111
+
112
+ flat_multimap(sorted_equivalent_t s, initializer_list<value_type> il,
113
+ const key_compare& comp = key_compare())
114
+ : flat_multimap(s, il.begin(), il.end(), comp) { }
115
+ template<class Allocator>
116
+ flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
117
+ const key_compare& comp, const Allocator& a);
118
+ template<class Allocator>
119
+ flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const Allocator& a);
120
+
121
+ flat_multimap& operator=(initializer_list<value_type> il);
122
+
123
+ // iterators
124
+ iterator begin() noexcept;
125
+ const_iterator begin() const noexcept;
126
+ iterator end() noexcept;
127
+ const_iterator end() const noexcept;
128
+
129
+ reverse_iterator rbegin() noexcept;
130
+ const_reverse_iterator rbegin() const noexcept;
131
+ reverse_iterator rend() noexcept;
132
+ const_reverse_iterator rend() const noexcept;
133
+
134
+ const_iterator cbegin() const noexcept;
135
+ const_iterator cend() const noexcept;
136
+ const_reverse_iterator crbegin() const noexcept;
137
+ const_reverse_iterator crend() const noexcept;
138
+
139
+ // capacity
140
+ [[nodiscard]] bool empty() const noexcept;
141
+ size_type size() const noexcept;
142
+ size_type max_size() const noexcept;
143
+
144
+ // modifiers
145
+ template<class... Args> iterator emplace(Args&&... args);
146
+ template<class... Args>
147
+ iterator emplace_hint(const_iterator position, Args&&... args);
148
+
149
+ iterator insert(const value_type& x)
150
+ { return emplace(x); }
151
+ iterator insert(value_type&& x)
152
+ { return emplace(std::move(x)); }
153
+ iterator insert(const_iterator position, const value_type& x)
154
+ { return emplace_hint(position, x); }
155
+ iterator insert(const_iterator position, value_type&& x)
156
+ { return emplace_hint(position, std::move(x)); }
157
+
158
+ template<class P> iterator insert(P&& x);
159
+ template<class P>
160
+ iterator insert(const_iterator position, P&&);
161
+ template<class InputIterator>
162
+ void insert(InputIterator first, InputIterator last);
163
+ template<class InputIterator>
164
+ void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
165
+ template<container-compatible-range<value_type> R>
166
+ void insert_range(R&& rg);
167
+
168
+ void insert(initializer_list<value_type> il)
169
+ { insert(il.begin(), il.end()); }
170
+ void insert(sorted_equivalent_t s, initializer_list<value_type> il)
171
+ { insert(s, il.begin(), il.end()); }
172
+
173
+ containers extract() &&;
174
+ void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
175
+
176
+ iterator erase(iterator position);
177
+ iterator erase(const_iterator position);
178
+ size_type erase(const key_type& x);
179
+ template<class K> size_type erase(K&& x);
180
+ iterator erase(const_iterator first, const_iterator last);
181
+
182
+ void swap(flat_multimap&) noexcept;
183
+ void clear() noexcept;
184
+
185
+ // observers
186
+ key_compare key_comp() const;
187
+ value_compare value_comp() const;
188
+
189
+ const key_container_type& keys() const noexcept { return c.keys; }
190
+ const mapped_container_type& values() const noexcept { return c.values; }
191
+
192
+ // map operations
193
+ iterator find(const key_type& x);
194
+ const_iterator find(const key_type& x) const;
195
+ template<class K> iterator find(const K& x);
196
+ template<class K> const_iterator find(const K& x) const;
197
+
198
+ size_type count(const key_type& x) const;
199
+ template<class K> size_type count(const K& x) const;
200
+
201
+ bool contains(const key_type& x) const;
202
+ template<class K> bool contains(const K& x) const;
203
+
204
+ iterator lower_bound(const key_type& x);
205
+ const_iterator lower_bound(const key_type& x) const;
206
+ template<class K> iterator lower_bound(const K& x);
207
+ template<class K> const_iterator lower_bound(const K& x) const;
208
+
209
+ iterator upper_bound(const key_type& x);
210
+ const_iterator upper_bound(const key_type& x) const;
211
+ template<class K> iterator upper_bound(const K& x);
212
+ template<class K> const_iterator upper_bound(const K& x) const;
213
+
214
+ pair<iterator, iterator> equal_range(const key_type& x);
215
+ pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
216
+ template<class K>
217
+ pair<iterator, iterator> equal_range(const K& x);
218
+ template<class K>
219
+ pair<const_iterator, const_iterator> equal_range(const K& x) const;
220
+
221
+ friend bool operator==(const flat_multimap& x, const flat_multimap& y);
222
+
223
+ friend synth-three-way-result<value_type>
224
+ operator<=>(const flat_multimap& x, const flat_multimap& y);
225
+
226
+ friend void swap(flat_multimap& x, flat_multimap& y) noexcept
227
+ { x.swap(y); }
228
+
229
+ private:
230
+ containers c; // exposition only
231
+ key_compare compare; // exposition only
232
+ };
233
+
234
+ template<class KeyContainer, class MappedContainer,
235
+ class Compare = less<typename KeyContainer::value_type>>
236
+ flat_multimap(KeyContainer, MappedContainer, Compare = Compare())
237
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
238
+ Compare, KeyContainer, MappedContainer>;
239
+
240
+ template<class KeyContainer, class MappedContainer, class Allocator>
241
+ flat_multimap(KeyContainer, MappedContainer, Allocator)
242
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
243
+ less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
244
+ template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
245
+ flat_multimap(KeyContainer, MappedContainer, Compare, Allocator)
246
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
247
+ Compare, KeyContainer, MappedContainer>;
248
+
249
+ template<class KeyContainer, class MappedContainer,
250
+ class Compare = less<typename KeyContainer::value_type>>
251
+ flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare = Compare())
252
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
253
+ Compare, KeyContainer, MappedContainer>;
254
+
255
+ template<class KeyContainer, class MappedContainer, class Allocator>
256
+ flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Allocator)
257
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
258
+ less<typename KeyContainer::value_type>, KeyContainer, MappedContainer>;
259
+ template<class KeyContainer, class MappedContainer, class Compare, class Allocator>
260
+ flat_multimap(sorted_equivalent_t, KeyContainer, MappedContainer, Compare, Allocator)
261
+ -> flat_multimap<typename KeyContainer::value_type, typename MappedContainer::value_type,
262
+ Compare, KeyContainer, MappedContainer>;
263
+
264
+ template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
265
+ flat_multimap(InputIterator, InputIterator, Compare = Compare())
266
+ -> flat_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
267
+
268
+ template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>>
269
+ flat_multimap(sorted_equivalent_t, InputIterator, InputIterator, Compare = Compare())
270
+ -> flat_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Compare>;
271
+
272
+ template<ranges::input_range R, class Compare = less<range-key-type<R>>,
273
+ class Allocator = allocator<byte>>
274
+ flat_multimap(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
275
+ -> flat_multimap<range-key-type<R>, range-mapped-type<R>, Compare,
276
+ vector<range-key-type<R>,
277
+ alloc-rebind<Allocator, range-key-type<R>>>,
278
+ vector<range-mapped-type<R>,
279
+ alloc-rebind<Allocator, range-mapped-type<R>>>>;
280
+
281
+ template<ranges::input_range R, class Allocator>
282
+ flat_multimap(from_range_t, R&&, Allocator)
283
+ -> flat_multimap<range-key-type<R>, range-mapped-type<R>, less<range-key-type<R>>,
284
+ vector<range-key-type<R>,
285
+ alloc-rebind<Allocator, range-key-type<R>>>,
286
+ vector<range-mapped-type<R>,
287
+ alloc-rebind<Allocator, range-mapped-type<R>>>>;
288
+
289
+ template<class Key, class T, class Compare = less<Key>>
290
+ flat_multimap(initializer_list<pair<Key, T>>, Compare = Compare())
291
+ -> flat_multimap<Key, T, Compare>;
292
+
293
+ template<class Key, class T, class Compare = less<Key>>
294
+ flat_multimap(sorted_equivalent_t, initializer_list<pair<Key, T>>, Compare = Compare())
295
+ -> flat_multimap<Key, T, Compare>;
296
+
297
+ template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
298
+ class Allocator>
299
+ struct uses_allocator<flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>,
300
+ Allocator>
301
+ : bool_constant<uses_allocator_v<KeyContainer, Allocator> &&
302
+ uses_allocator_v<MappedContainer, Allocator>> { };
303
+ }
304
+ ```
305
+
306
+ The member type `containers` has the data members and special members
307
+ specified above. It has no base classes or members other than those
308
+ specified.
309
+