From Jason Turner

[flat.multiset]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpu6du8qpg/{from.md → to.md} +201 -182
tmp/tmpu6du8qpg/{from.md → to.md} RENAMED
@@ -53,14 +53,17 @@ In particular, `vector` [[vector]] and `deque` [[deque]] can be used.
53
  [*Note 3*: `vector<bool>` is not a sequence container. — *end note*]
54
 
55
  The program is ill-formed if `Key` is not the same type as
56
  `KeyContainer::value_type`.
57
 
58
- The effect of calling a constructor or member function that takes a
59
  `sorted_equivalent_t` argument with a range that is not sorted with
60
  respect to `key_comp()` is undefined.
61
 
 
 
 
62
  #### Definition <a id="flat.multiset.defn">[[flat.multiset.defn]]</a>
63
 
64
  ``` cpp
65
  namespace std {
66
  template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
@@ -71,194 +74,205 @@ namespace std {
71
  using value_type = Key;
72
  using key_compare = Compare;
73
  using value_compare = Compare;
74
  using reference = value_type&;
75
  using const_reference = const value_type&;
76
- using size_type = typename KeyContainer::size_type;
77
- using difference_type = typename KeyContainer::difference_type;
78
  using iterator = implementation-defined // type of flat_multiset::iterator; // see [container.requirements]
79
  using const_iterator = implementation-defined // type of flat_multiset::const_iterator; // see [container.requirements]
80
  using reverse_iterator = std::reverse_iterator<iterator>;
81
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
82
  using container_type = KeyContainer;
83
 
84
  // [flat.multiset.cons], constructors
85
- flat_multiset() : flat_multiset(key_compare()) { }
86
 
87
- explicit flat_multiset(container_type cont, const key_compare& comp = key_compare());
88
- template<class Allocator>
89
- flat_multiset(const container_type& cont, const Allocator& a);
90
- template<class Allocator>
91
- flat_multiset(const container_type& cont, const key_compare& comp, const Allocator& a);
92
-
93
- flat_multiset(sorted_equivalent_t, container_type cont,
94
- const key_compare& comp = key_compare())
95
- : c(std::move(cont)), compare(comp) { }
96
- template<class Allocator>
97
- flat_multiset(sorted_equivalent_t, const container_type&, const Allocator& a);
98
- template<class Allocator>
99
- flat_multiset(sorted_equivalent_t, const container_type& cont,
100
- const key_compare& comp, const Allocator& a);
101
-
102
- explicit flat_multiset(const key_compare& comp)
103
  : c(), compare(comp) { }
104
- template<class Allocator>
105
- flat_multiset(const key_compare& comp, const Allocator& a);
106
- template<class Allocator>
107
- explicit flat_multiset(const Allocator& a);
 
 
 
108
 
109
  template<class InputIterator>
110
- flat_multiset(InputIterator first, InputIterator last,
111
  const key_compare& comp = key_compare())
112
  : c(), compare(comp)
113
  { insert(first, last); }
114
- template<class InputIterator, class Allocator>
115
- flat_multiset(InputIterator first, InputIterator last,
116
- const key_compare& comp, const Allocator& a);
117
- template<class InputIterator, class Allocator>
118
- flat_multiset(InputIterator first, InputIterator last, const Allocator& a);
119
 
120
  template<container-compatible-range<value_type> R>
121
- flat_multiset(from_range_t fr, R&& rg)
122
- : flat_multiset(fr, std::forward<R>(rg), key_compare()) { }
123
- template<container-compatible-range<value_type> R, class Allocator>
124
- flat_multiset(from_range_t, R&& rg, const Allocator& a);
125
  template<container-compatible-range<value_type> R>
126
- flat_multiset(from_range_t, R&& rg, const key_compare& comp)
127
  : flat_multiset(comp)
128
  { insert_range(std::forward<R>(rg)); }
129
- template<container-compatible-range<value_type> R, class Allocator>
130
- flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
131
 
132
- template<class InputIterator>
133
- flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
134
  const key_compare& comp = key_compare())
135
- : c(first, last), compare(comp) { }
136
- template<class InputIterator, class Allocator>
137
- flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
138
- const key_compare& comp, const Allocator& a);
139
- template<class InputIterator, class Allocator>
140
- flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
141
- const Allocator& a);
142
-
143
- flat_multiset(initializer_list<value_type> il, const key_compare& comp = key_compare())
144
  : flat_multiset(il.begin(), il.end(), comp) { }
145
- template<class Allocator>
146
- flat_multiset(initializer_list<value_type> il, const key_compare& comp,
147
- const Allocator& a);
148
- template<class Allocator>
149
- flat_multiset(initializer_list<value_type> il, const Allocator& a);
150
 
151
- flat_multiset(sorted_equivalent_t s, initializer_list<value_type> il,
152
  const key_compare& comp = key_compare())
153
- : flat_multiset(s, il.begin(), il.end(), comp) { }
154
- template<class Allocator>
155
- flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
156
- const key_compare& comp, const Allocator& a);
157
- template<class Allocator>
158
- flat_multiset(sorted_equivalent_t, initializer_list<value_type> il, const Allocator& a);
159
 
160
- flat_multiset& operator=(initializer_list<value_type>);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
 
162
  // iterators
163
- iterator begin() noexcept;
164
- const_iterator begin() const noexcept;
165
- iterator end() noexcept;
166
- const_iterator end() const noexcept;
167
 
168
- reverse_iterator rbegin() noexcept;
169
- const_reverse_iterator rbegin() const noexcept;
170
- reverse_iterator rend() noexcept;
171
- const_reverse_iterator rend() const noexcept;
172
 
173
- const_iterator cbegin() const noexcept;
174
- const_iterator cend() const noexcept;
175
- const_reverse_iterator crbegin() const noexcept;
176
- const_reverse_iterator crend() const noexcept;
177
 
178
  // capacity
179
- [[nodiscard]] bool empty() const noexcept;
180
- size_type size() const noexcept;
181
- size_type max_size() const noexcept;
182
 
183
  // [flat.multiset.modifiers], modifiers
184
- template<class... Args> iterator emplace(Args&&... args);
185
  template<class... Args>
186
- iterator emplace_hint(const_iterator position, Args&&... args);
187
 
188
- iterator insert(const value_type& x)
189
  { return emplace(x); }
190
- iterator insert(value_type&& x)
191
  { return emplace(std::move(x)); }
192
- iterator insert(const_iterator position, const value_type& x)
193
  { return emplace_hint(position, x); }
194
- iterator insert(const_iterator position, value_type&& x)
195
  { return emplace_hint(position, std::move(x)); }
196
 
197
  template<class InputIterator>
198
- void insert(InputIterator first, InputIterator last);
199
  template<class InputIterator>
200
- void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
201
  template<container-compatible-range<value_type> R>
202
- void insert_range(R&& rg);
203
 
204
- void insert(initializer_list<value_type> il)
205
  { insert(il.begin(), il.end()); }
206
- void insert(sorted_equivalent_t s, initializer_list<value_type> il)
207
- { insert(s, il.begin(), il.end()); }
208
 
209
- container_type extract() &&;
210
- void replace(container_type&&);
211
 
212
- iterator erase(iterator position);
213
- iterator erase(const_iterator position);
214
- size_type erase(const key_type& x);
215
- template<class K> size_type erase(K&& x);
216
- iterator erase(const_iterator first, const_iterator last);
217
 
218
- void swap(flat_multiset& y) noexcept;
219
- void clear() noexcept;
220
 
221
  // observers
222
- key_compare key_comp() const;
223
- value_compare value_comp() const;
224
 
225
  // set operations
226
- iterator find(const key_type& x);
227
- const_iterator find(const key_type& x) const;
228
- template<class K> iterator find(const K& x);
229
- template<class K> const_iterator find(const K& x) const;
230
 
231
- size_type count(const key_type& x) const;
232
- template<class K> size_type count(const K& x) const;
233
 
234
- bool contains(const key_type& x) const;
235
- template<class K> bool contains(const K& x) const;
236
 
237
- iterator lower_bound(const key_type& x);
238
- const_iterator lower_bound(const key_type& x) const;
239
- template<class K> iterator lower_bound(const K& x);
240
- template<class K> const_iterator lower_bound(const K& x) const;
241
 
242
- iterator upper_bound(const key_type& x);
243
- const_iterator upper_bound(const key_type& x) const;
244
- template<class K> iterator upper_bound(const K& x);
245
- template<class K> const_iterator upper_bound(const K& x) const;
246
 
247
- pair<iterator, iterator> equal_range(const key_type& x);
248
- pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
249
  template<class K>
250
- pair<iterator, iterator> equal_range(const K& x);
251
  template<class K>
252
- pair<const_iterator, const_iterator> equal_range(const K& x) const;
253
 
254
- friend bool operator==(const flat_multiset& x, const flat_multiset& y);
255
 
256
- friend synth-three-way-result<value_type>
257
  operator<=>(const flat_multiset& x, const flat_multiset& y);
258
 
259
- friend void swap(flat_multiset& x, flat_multiset& y) noexcept
260
  { x.swap(y); }
261
 
262
  private:
263
  container_type c; // exposition only
264
  key_compare compare; // exposition only
@@ -286,15 +300,15 @@ namespace std {
286
  flat_multiset(sorted_equivalent_t, KeyContainer, Compare, Allocator)
287
  -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
288
 
289
  template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
290
  flat_multiset(InputIterator, InputIterator, Compare = Compare())
291
- -> flat_multiset<iter-value-type<InputIterator>, iter-value-type<InputIterator>, Compare>;
292
 
293
  template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
294
  flat_multiset(sorted_equivalent_t, InputIterator, InputIterator, Compare = Compare())
295
- -> flat_multiset<iter-value-type<InputIterator>, iter-value-type<InputIterator>, Compare>;
296
 
297
  template<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>,
298
  class Allocator = allocator<ranges::range_value_t<R>>>
299
  flat_multiset(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
300
  -> flat_multiset<ranges::range_value_t<R>, Compare,
@@ -322,95 +336,100 @@ namespace std {
322
  ```
323
 
324
  #### Constructors <a id="flat.multiset.cons">[[flat.multiset.cons]]</a>
325
 
326
  ``` cpp
327
- explicit flat_multiset(container_type cont, const key_compare& comp = key_compare());
328
  ```
329
 
330
  *Effects:* Initializes *c* with `std::move(cont)` and *compare* with
331
  `comp`, and sorts the range \[`begin()`, `end()`) with respect to
332
  *compare*.
333
 
334
- *Complexity:* Linear in N if `cont` is sorted with respect to *compare*
335
- and otherwise N log N, where N is the value of `cont.size()` before this
336
- call.
 
 
 
 
 
337
 
338
  ``` cpp
339
- template<class Allocator>
340
- flat_multiset(const container_type& cont, const Allocator& a);
341
- template<class Allocator>
342
- flat_multiset(const container_type& cont, const key_compare& comp, const Allocator& a);
343
  ```
344
 
345
- *Constraints:* `uses_allocator_v<container_type, Allocator>` is `true`.
346
-
347
  *Effects:* Equivalent to `flat_multiset(cont)` and
348
  `flat_multiset(cont, comp)`, respectively, except that *c* is
349
  constructed with uses-allocator
350
  construction [[allocator.uses.construction]].
351
 
352
  *Complexity:* Same as `flat_multiset(cont)` and
353
  `flat_multiset(cont, comp)`, respectively.
354
 
355
  ``` cpp
356
- template<class Allocator>
357
- flat_multiset(sorted_equivalent_t s, const container_type& cont, const Allocator& a);
358
- template<class Allocator>
359
- flat_multiset(sorted_equivalent_t s, const container_type& cont,
360
- const key_compare& comp, const Allocator& a);
361
  ```
362
 
363
- *Constraints:* `uses_allocator_v<container_type, Allocator>` is `true`.
364
-
365
- *Effects:* Equivalent to `flat_multiset(s, cont)` and
366
- `flat_multiset(s, cont, comp)`, respectively, except that *c* is
367
- constructed with uses-allocator
368
  construction [[allocator.uses.construction]].
369
 
370
  *Complexity:* Linear.
371
 
372
  ``` cpp
373
- template<class Allocator>
374
- flat_multiset(const key_compare& comp, const Allocator& a);
375
- template<class Allocator>
376
- explicit flat_multiset(const Allocator& a);
377
- template<class InputIterator, class Allocator>
378
- flat_multiset(InputIterator first, InputIterator last,
379
- const key_compare& comp, const Allocator& a);
380
- template<class InputIterator, class Allocator>
381
- flat_multiset(InputIterator first, InputIterator last, const Allocator& a);
382
- template<container-compatible-range<value_type> R, class Allocator>
383
- flat_multiset(from_range_t, R&& rg, const Allocator& a);
384
- template<container-compatible-range<value_type> R, class Allocator>
385
- flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
386
- template<class InputIterator, class Allocator>
387
- flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
388
- const key_compare& comp, const Allocator& a);
389
- template<class InputIterator, class Allocator>
390
- flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last, const Allocator& a);
391
- template<class Allocator>
392
- flat_multiset(initializer_list<value_type> il, const key_compare& comp, const Allocator& a);
393
- template<class Allocator>
394
- flat_multiset(initializer_list<value_type> il, const Allocator& a);
395
- template<class Allocator>
396
- flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
397
- const key_compare& comp, const Allocator& a);
398
- template<class Allocator>
399
- flat_multiset(sorted_equivalent_t, initializer_list<value_type> il, const Allocator& a);
 
 
 
 
 
 
400
  ```
401
 
402
- *Constraints:* `uses_allocator_v<container_type, Allocator>` is `true`.
403
-
404
  *Effects:* Equivalent to the corresponding non-allocator constructors
405
  except that *c* is constructed with uses-allocator
406
  construction [[allocator.uses.construction]].
407
 
408
  #### Modifiers <a id="flat.multiset.modifiers">[[flat.multiset.modifiers]]</a>
409
 
410
  ``` cpp
411
- template<class... Args> iterator emplace(Args&&... args);
412
  ```
413
 
414
  *Constraints:* `is_constructible_v<value_type, Args...>` is `true`.
415
 
416
  *Effects:* First, initializes an object `t` of type `value_type` with
@@ -423,11 +442,11 @@ c.insert(it, std::move(t));
423
 
424
  *Returns:* An iterator that points to the inserted element.
425
 
426
  ``` cpp
427
  template<class InputIterator>
428
- void insert(InputIterator first, InputIterator last);
429
  ```
430
 
431
  *Effects:* Adds elements to *c* as if by:
432
 
433
  ``` cpp
@@ -444,51 +463,51 @@ M is `distance(first, last)`.
444
  *Remarks:* Since this operation performs an in-place merge, it may
445
  allocate memory.
446
 
447
  ``` cpp
448
  template<class InputIterator>
449
- void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
450
  ```
451
 
452
  *Effects:* Equivalent to `insert(first, last)`.
453
 
454
  *Complexity:* Linear.
455
 
456
  ``` cpp
457
- void swap(flat_multiset& y) noexcept;
458
  ```
459
 
460
  *Effects:* Equivalent to:
461
 
462
  ``` cpp
463
  ranges::swap(compare, y.compare);
464
  ranges::swap(c, y.c);
465
  ```
466
 
467
  ``` cpp
468
- container_type extract() &&;
469
  ```
470
 
471
  *Ensures:* `*this` is emptied, even if the function exits via an
472
  exception.
473
 
474
- *Returns:* `std::move(c)`.
475
 
476
  ``` cpp
477
- void replace(container_type&& cont);
478
  ```
479
 
480
  *Preconditions:* The elements of `cont` are sorted with respect to
481
  *compare*.
482
 
483
- *Effects:* Equivalent to: `c = std::move(cont);`
484
 
485
  #### Erasure <a id="flat.multiset.erasure">[[flat.multiset.erasure]]</a>
486
 
487
  ``` cpp
488
  template<class Key, class Compare, class KeyContainer, class Predicate>
489
- typename flat_multiset<Key, Compare, KeyContainer>::size_type
490
  erase_if(flat_multiset<Key, Compare, KeyContainer>& c, Predicate pred);
491
  ```
492
 
493
  *Preconditions:* `Key` meets the *Cpp17MoveAssignable* requirements.
494
 
 
53
  [*Note 3*: `vector<bool>` is not a sequence container. — *end note*]
54
 
55
  The program is ill-formed if `Key` is not the same type as
56
  `KeyContainer::value_type`.
57
 
58
+ The effect of calling a member function that takes a
59
  `sorted_equivalent_t` argument with a range that is not sorted with
60
  respect to `key_comp()` is undefined.
61
 
62
+ The types `iterator` and `const_iterator` meet the constexpr iterator
63
+ requirements [[iterator.requirements.general]].
64
+
65
  #### Definition <a id="flat.multiset.defn">[[flat.multiset.defn]]</a>
66
 
67
  ``` cpp
68
  namespace std {
69
  template<class Key, class Compare = less<Key>, class KeyContainer = vector<Key>>
 
74
  using value_type = Key;
75
  using key_compare = Compare;
76
  using value_compare = Compare;
77
  using reference = value_type&;
78
  using const_reference = const value_type&;
79
+ using size_type = KeyContainer::size_type;
80
+ using difference_type = KeyContainer::difference_type;
81
  using iterator = implementation-defined // type of flat_multiset::iterator; // see [container.requirements]
82
  using const_iterator = implementation-defined // type of flat_multiset::const_iterator; // see [container.requirements]
83
  using reverse_iterator = std::reverse_iterator<iterator>;
84
  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
85
  using container_type = KeyContainer;
86
 
87
  // [flat.multiset.cons], constructors
88
+ constexpr flat_multiset() : flat_multiset(key_compare()) { }
89
 
90
+ constexpr explicit flat_multiset(const key_compare& comp)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  : c(), compare(comp) { }
92
+
93
+ constexpr explicit flat_multiset(container_type cont,
94
+ const key_compare& comp = key_compare());
95
+
96
+ constexpr flat_multiset(sorted_equivalent_t, container_type cont,
97
+ const key_compare& comp = key_compare())
98
+ : c(std::move(cont)), compare(comp) { }
99
 
100
  template<class InputIterator>
101
+ constexpr flat_multiset(InputIterator first, InputIterator last,
102
  const key_compare& comp = key_compare())
103
  : c(), compare(comp)
104
  { insert(first, last); }
105
+
106
+ template<class InputIterator>
107
+ constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
108
+ const key_compare& comp = key_compare())
109
+ : c(first, last), compare(comp) { }
110
 
111
  template<container-compatible-range<value_type> R>
112
+ constexpr flat_multiset(from_range_t, R&& rg)
113
+ : flat_multiset(from_range, std::forward<R>(rg), key_compare()) { }
 
 
114
  template<container-compatible-range<value_type> R>
115
+ constexpr flat_multiset(from_range_t, R&& rg, const key_compare& comp)
116
  : flat_multiset(comp)
117
  { insert_range(std::forward<R>(rg)); }
 
 
118
 
119
+ constexpr flat_multiset(initializer_list<value_type> il,
 
120
  const key_compare& comp = key_compare())
 
 
 
 
 
 
 
 
 
121
  : flat_multiset(il.begin(), il.end(), comp) { }
 
 
 
 
 
122
 
123
+ constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
124
  const key_compare& comp = key_compare())
125
+ : flat_multiset(sorted_equivalent, il.begin(), il.end(), comp) { }
 
 
 
 
 
126
 
127
+ // [flat.multiset.cons.alloc], constructors with allocators
128
+
129
+ template<class Alloc>
130
+ constexpr explicit flat_multiset(const Alloc& a);
131
+ template<class Alloc>
132
+ constexpr flat_multiset(const key_compare& comp, const Alloc& a);
133
+ template<class Alloc>
134
+ constexpr flat_multiset(const container_type& cont, const Alloc& a);
135
+ template<class Alloc>
136
+ constexpr flat_multiset(const container_type& cont, const key_compare& comp,
137
+ const Alloc& a);
138
+ template<class Alloc>
139
+ constexpr flat_multiset(sorted_equivalent_t, const container_type& cont, const Alloc& a);
140
+ template<class Alloc>
141
+ constexpr flat_multiset(sorted_equivalent_t, const container_type& cont,
142
+ const key_compare& comp, const Alloc& a);
143
+ template<class Alloc>
144
+ constexpr flat_multiset(const flat_multiset&, const Alloc& a);
145
+ template<class Alloc>
146
+ constexpr flat_multiset(flat_multiset&&, const Alloc& a);
147
+ template<class InputIterator, class Alloc>
148
+ constexpr flat_multiset(InputIterator first, InputIterator last, const Alloc& a);
149
+ template<class InputIterator, class Alloc>
150
+ constexpr flat_multiset(InputIterator first, InputIterator last,
151
+ const key_compare& comp, const Alloc& a);
152
+ template<class InputIterator, class Alloc>
153
+ constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
154
+ const Alloc& a);
155
+ template<class InputIterator, class Alloc>
156
+ constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
157
+ const key_compare& comp, const Alloc& a);
158
+ template<container-compatible-range<value_type> R, class Alloc>
159
+ constexpr flat_multiset(from_range_t, R&& rg, const Alloc& a);
160
+ template<container-compatible-range<value_type> R, class Alloc>
161
+ constexpr flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
162
+ template<class Alloc>
163
+ constexpr flat_multiset(initializer_list<value_type> il, const Alloc& a);
164
+ template<class Alloc>
165
+ constexpr flat_multiset(initializer_list<value_type> il, const key_compare& comp,
166
+ const Alloc& a);
167
+ template<class Alloc>
168
+ constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
169
+ const Alloc& a);
170
+ template<class Alloc>
171
+ constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
172
+ const key_compare& comp, const Alloc& a);
173
+
174
+ constexpr flat_multiset& operator=(initializer_list<value_type>);
175
 
176
  // iterators
177
+ constexpr iterator begin() noexcept;
178
+ constexpr const_iterator begin() const noexcept;
179
+ constexpr iterator end() noexcept;
180
+ constexpr const_iterator end() const noexcept;
181
 
182
+ constexpr reverse_iterator rbegin() noexcept;
183
+ constexpr const_reverse_iterator rbegin() const noexcept;
184
+ constexpr reverse_iterator rend() noexcept;
185
+ constexpr const_reverse_iterator rend() const noexcept;
186
 
187
+ constexpr const_iterator cbegin() const noexcept;
188
+ constexpr const_iterator cend() const noexcept;
189
+ constexpr const_reverse_iterator crbegin() const noexcept;
190
+ constexpr const_reverse_iterator crend() const noexcept;
191
 
192
  // capacity
193
+ constexpr bool empty() const noexcept;
194
+ constexpr size_type size() const noexcept;
195
+ constexpr size_type max_size() const noexcept;
196
 
197
  // [flat.multiset.modifiers], modifiers
198
+ template<class... Args> constexpr iterator emplace(Args&&... args);
199
  template<class... Args>
200
+ constexpr iterator emplace_hint(const_iterator position, Args&&... args);
201
 
202
+ constexpr iterator insert(const value_type& x)
203
  { return emplace(x); }
204
+ constexpr iterator insert(value_type&& x)
205
  { return emplace(std::move(x)); }
206
+ constexpr iterator insert(const_iterator position, const value_type& x)
207
  { return emplace_hint(position, x); }
208
+ constexpr iterator insert(const_iterator position, value_type&& x)
209
  { return emplace_hint(position, std::move(x)); }
210
 
211
  template<class InputIterator>
212
+ constexpr void insert(InputIterator first, InputIterator last);
213
  template<class InputIterator>
214
+ constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
215
  template<container-compatible-range<value_type> R>
216
+ constexpr void insert_range(R&& rg);
217
 
218
+ constexpr void insert(initializer_list<value_type> il)
219
  { insert(il.begin(), il.end()); }
220
+ constexpr void insert(sorted_equivalent_t, initializer_list<value_type> il)
221
+ { insert(sorted_equivalent, il.begin(), il.end()); }
222
 
223
+ constexpr container_type extract() &&;
224
+ constexpr void replace(container_type&&);
225
 
226
+ constexpr iterator erase(iterator position);
227
+ constexpr iterator erase(const_iterator position);
228
+ constexpr size_type erase(const key_type& x);
229
+ template<class K> constexpr size_type erase(K&& x);
230
+ constexpr iterator erase(const_iterator first, const_iterator last);
231
 
232
+ constexpr void swap(flat_multiset& y) noexcept;
233
+ constexpr void clear() noexcept;
234
 
235
  // observers
236
+ constexpr key_compare key_comp() const;
237
+ constexpr value_compare value_comp() const;
238
 
239
  // set operations
240
+ constexpr iterator find(const key_type& x);
241
+ constexpr const_iterator find(const key_type& x) const;
242
+ template<class K> constexpr iterator find(const K& x);
243
+ template<class K> constexpr const_iterator find(const K& x) const;
244
 
245
+ constexpr size_type count(const key_type& x) const;
246
+ template<class K> constexpr size_type count(const K& x) const;
247
 
248
+ constexpr bool contains(const key_type& x) const;
249
+ template<class K> constexpr bool contains(const K& x) const;
250
 
251
+ constexpr iterator lower_bound(const key_type& x);
252
+ constexpr const_iterator lower_bound(const key_type& x) const;
253
+ template<class K> constexpr iterator lower_bound(const K& x);
254
+ template<class K> constexpr const_iterator lower_bound(const K& x) const;
255
 
256
+ constexpr iterator upper_bound(const key_type& x);
257
+ constexpr const_iterator upper_bound(const key_type& x) const;
258
+ template<class K> constexpr iterator upper_bound(const K& x);
259
+ template<class K> constexpr const_iterator upper_bound(const K& x) const;
260
 
261
+ constexpr pair<iterator, iterator> equal_range(const key_type& x);
262
+ constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
263
  template<class K>
264
+ constexpr pair<iterator, iterator> equal_range(const K& x);
265
  template<class K>
266
+ constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
267
 
268
+ friend constexpr bool operator==(const flat_multiset& x, const flat_multiset& y);
269
 
270
+ friend constexpr synth-three-way-result<value_type>
271
  operator<=>(const flat_multiset& x, const flat_multiset& y);
272
 
273
+ friend constexpr void swap(flat_multiset& x, flat_multiset& y) noexcept
274
  { x.swap(y); }
275
 
276
  private:
277
  container_type c; // exposition only
278
  key_compare compare; // exposition only
 
300
  flat_multiset(sorted_equivalent_t, KeyContainer, Compare, Allocator)
301
  -> flat_multiset<typename KeyContainer::value_type, Compare, KeyContainer>;
302
 
303
  template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
304
  flat_multiset(InputIterator, InputIterator, Compare = Compare())
305
+ -> flat_multiset<iter-value-type<InputIterator>, Compare>;
306
 
307
  template<class InputIterator, class Compare = less<iter-value-type<InputIterator>>>
308
  flat_multiset(sorted_equivalent_t, InputIterator, InputIterator, Compare = Compare())
309
+ -> flat_multiset<iter-value-type<InputIterator>, Compare>;
310
 
311
  template<ranges::input_range R, class Compare = less<ranges::range_value_t<R>>,
312
  class Allocator = allocator<ranges::range_value_t<R>>>
313
  flat_multiset(from_range_t, R&&, Compare = Compare(), Allocator = Allocator())
314
  -> flat_multiset<ranges::range_value_t<R>, Compare,
 
336
  ```
337
 
338
  #### Constructors <a id="flat.multiset.cons">[[flat.multiset.cons]]</a>
339
 
340
  ``` cpp
341
+ constexpr explicit flat_multiset(container_type cont, const key_compare& comp = key_compare());
342
  ```
343
 
344
  *Effects:* Initializes *c* with `std::move(cont)` and *compare* with
345
  `comp`, and sorts the range \[`begin()`, `end()`) with respect to
346
  *compare*.
347
 
348
+ *Complexity:* Linear in N if `cont` is already sorted with respect to
349
+ *compare* and otherwise N log N, where N is the value of `cont.size()`
350
+ before this call.
351
+
352
+ #### Constructors with allocators <a id="flat.multiset.cons.alloc">[[flat.multiset.cons.alloc]]</a>
353
+
354
+ The constructors in this subclause shall not participate in overload
355
+ resolution unless `uses_allocator_v<container_type, Alloc>` is `true`.
356
 
357
  ``` cpp
358
+ template<class Alloc>
359
+ constexpr flat_multiset(const container_type& cont, const Alloc& a);
360
+ template<class Alloc>
361
+ constexpr flat_multiset(const container_type& cont, const key_compare& comp, const Alloc& a);
362
  ```
363
 
 
 
364
  *Effects:* Equivalent to `flat_multiset(cont)` and
365
  `flat_multiset(cont, comp)`, respectively, except that *c* is
366
  constructed with uses-allocator
367
  construction [[allocator.uses.construction]].
368
 
369
  *Complexity:* Same as `flat_multiset(cont)` and
370
  `flat_multiset(cont, comp)`, respectively.
371
 
372
  ``` cpp
373
+ template<class Alloc>
374
+ constexpr flat_multiset(sorted_equivalent_t, const container_type& cont, const Alloc& a);
375
+ template<class Alloc>
376
+ constexpr flat_multiset(sorted_equivalent_t, const container_type& cont,
377
+ const key_compare& comp, const Alloc& a);
378
  ```
379
 
380
+ *Effects:* Equivalent to `flat_multiset(sorted_equivalent, cont)` and
381
+ `flat_multiset(sorted_equivalent, cont, comp)`, respectively, except
382
+ that *c* is constructed with uses-allocator
 
 
383
  construction [[allocator.uses.construction]].
384
 
385
  *Complexity:* Linear.
386
 
387
  ``` cpp
388
+ template<class Alloc>
389
+ constexpr explicit flat_multiset(const Alloc& a);
390
+ template<class Alloc>
391
+ constexpr flat_multiset(const key_compare& comp, const Alloc& a);
392
+ template<class Alloc>
393
+ constexpr flat_multiset(const flat_multiset&, const Alloc& a);
394
+ template<class Alloc>
395
+ constexpr flat_multiset(flat_multiset&&, const Alloc& a);
396
+ template<class InputIterator, class Alloc>
397
+ constexpr flat_multiset(InputIterator first, InputIterator last, const Alloc& a);
398
+ template<class InputIterator, class Alloc>
399
+ constexpr flat_multiset(InputIterator first, InputIterator last,
400
+ const key_compare& comp, const Alloc& a);
401
+ template<class InputIterator, class Alloc>
402
+ constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
403
+ const Alloc& a);
404
+ template<class InputIterator, class Alloc>
405
+ constexpr flat_multiset(sorted_equivalent_t, InputIterator first, InputIterator last,
406
+ const key_compare& comp, const Alloc& a);
407
+ template<container-compatible-range<value_type> R, class Alloc>
408
+ constexpr flat_multiset(from_range_t, R&& rg, const Alloc& a);
409
+ template<container-compatible-range<value_type> R, class Alloc>
410
+ constexpr flat_multiset(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
411
+ template<class Alloc>
412
+ constexpr flat_multiset(initializer_list<value_type> il, const Alloc& a);
413
+ template<class Alloc>
414
+ constexpr flat_multiset(initializer_list<value_type> il, const key_compare& comp,
415
+ const Alloc& a);
416
+ template<class Alloc>
417
+ constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il, const Alloc& a);
418
+ template<class Alloc>
419
+ constexpr flat_multiset(sorted_equivalent_t, initializer_list<value_type> il,
420
+ const key_compare& comp, const Alloc& a);
421
  ```
422
 
 
 
423
  *Effects:* Equivalent to the corresponding non-allocator constructors
424
  except that *c* is constructed with uses-allocator
425
  construction [[allocator.uses.construction]].
426
 
427
  #### Modifiers <a id="flat.multiset.modifiers">[[flat.multiset.modifiers]]</a>
428
 
429
  ``` cpp
430
+ template<class... Args> constexpr iterator emplace(Args&&... args);
431
  ```
432
 
433
  *Constraints:* `is_constructible_v<value_type, Args...>` is `true`.
434
 
435
  *Effects:* First, initializes an object `t` of type `value_type` with
 
442
 
443
  *Returns:* An iterator that points to the inserted element.
444
 
445
  ``` cpp
446
  template<class InputIterator>
447
+ constexpr void insert(InputIterator first, InputIterator last);
448
  ```
449
 
450
  *Effects:* Adds elements to *c* as if by:
451
 
452
  ``` cpp
 
463
  *Remarks:* Since this operation performs an in-place merge, it may
464
  allocate memory.
465
 
466
  ``` cpp
467
  template<class InputIterator>
468
+ constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
469
  ```
470
 
471
  *Effects:* Equivalent to `insert(first, last)`.
472
 
473
  *Complexity:* Linear.
474
 
475
  ``` cpp
476
+ constexpr void swap(flat_multiset& y) noexcept;
477
  ```
478
 
479
  *Effects:* Equivalent to:
480
 
481
  ``` cpp
482
  ranges::swap(compare, y.compare);
483
  ranges::swap(c, y.c);
484
  ```
485
 
486
  ``` cpp
487
+ constexpr container_type extract() &&;
488
  ```
489
 
490
  *Ensures:* `*this` is emptied, even if the function exits via an
491
  exception.
492
 
493
+ *Returns:* `std::move(`*`c`*`)`.
494
 
495
  ``` cpp
496
+ constexpr void replace(container_type&& cont);
497
  ```
498
 
499
  *Preconditions:* The elements of `cont` are sorted with respect to
500
  *compare*.
501
 
502
+ *Effects:* Equivalent to: *`c`*` = std::move(cont);`
503
 
504
  #### Erasure <a id="flat.multiset.erasure">[[flat.multiset.erasure]]</a>
505
 
506
  ``` cpp
507
  template<class Key, class Compare, class KeyContainer, class Predicate>
508
+ constexpr typename flat_multiset<Key, Compare, KeyContainer>::size_type
509
  erase_if(flat_multiset<Key, Compare, KeyContainer>& c, Predicate pred);
510
  ```
511
 
512
  *Preconditions:* `Key` meets the *Cpp17MoveAssignable* requirements.
513