- tmp/tmpcgln0_o4/{from.md → to.md} +220 -204
tmp/tmpcgln0_o4/{from.md → to.md}
RENAMED
|
@@ -69,14 +69,17 @@ The program is ill-formed if `Key` is not the same type as
|
|
| 69 |
|
| 70 |
The effect of calling a constructor that takes both `key_container_type`
|
| 71 |
and `mapped_container_type` arguments with containers of different sizes
|
| 72 |
is undefined.
|
| 73 |
|
| 74 |
-
The effect of calling a
|
| 75 |
`sorted_equivalent_t` argument with a container, containers, or range
|
| 76 |
that are not sorted with respect to `key_comp()` is undefined.
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
#### Definition <a id="flat.multimap.defn">[[flat.multimap.defn]]</a>
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
namespace std {
|
| 82 |
template<class Key, class T, class Compare = less<Key>,
|
|
@@ -100,209 +103,219 @@ namespace std {
|
|
| 100 |
using mapped_container_type = MappedContainer;
|
| 101 |
|
| 102 |
class value_compare {
|
| 103 |
private:
|
| 104 |
key_compare comp; // exposition only
|
| 105 |
-
value_compare(key_compare c) : comp(c) { }
|
| 106 |
|
| 107 |
public:
|
| 108 |
-
bool operator()(const_reference x, const_reference y) const {
|
| 109 |
return comp(x.first, y.first);
|
| 110 |
}
|
| 111 |
};
|
| 112 |
|
| 113 |
struct containers {
|
| 114 |
key_container_type keys;
|
| 115 |
mapped_container_type values;
|
| 116 |
};
|
| 117 |
|
| 118 |
-
// [flat.multimap.cons],
|
| 119 |
-
flat_multimap() : flat_multimap(key_compare()) { }
|
| 120 |
|
| 121 |
-
flat_multimap(
|
| 122 |
-
const key_compare& comp = key_compare());
|
| 123 |
-
template<class Allocator>
|
| 124 |
-
flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
|
| 125 |
-
const Allocator& a);
|
| 126 |
-
template<class Allocator>
|
| 127 |
-
flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
|
| 128 |
-
const key_compare& comp, const Allocator& a);
|
| 129 |
-
|
| 130 |
-
flat_multimap(sorted_equivalent_t,
|
| 131 |
-
key_container_type key_cont, mapped_container_type mapped_cont,
|
| 132 |
-
const key_compare& comp = key_compare());
|
| 133 |
-
template<class Allocator>
|
| 134 |
-
flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
| 135 |
-
const mapped_container_type& mapped_cont, const Allocator& a);
|
| 136 |
-
template<class Allocator>
|
| 137 |
-
flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
| 138 |
-
const mapped_container_type& mapped_cont,
|
| 139 |
-
const key_compare& comp, const Allocator& a);
|
| 140 |
-
|
| 141 |
-
explicit flat_multimap(const key_compare& comp)
|
| 142 |
: c(), compare(comp) { }
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
template<class InputIterator>
|
| 149 |
-
flat_multimap(InputIterator first, InputIterator last,
|
| 150 |
const key_compare& comp = key_compare())
|
| 151 |
: c(), compare(comp)
|
| 152 |
{ insert(first, last); }
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
|
| 159 |
template<container-compatible-range<value_type> R>
|
| 160 |
-
flat_multimap(from_range_t
|
| 161 |
-
: flat_multimap(
|
| 162 |
-
template<container-compatible-range<value_type> R, class Allocator>
|
| 163 |
-
flat_multimap(from_range_t, R&& rg, const Allocator& a);
|
| 164 |
template<container-compatible-range<value_type> R>
|
| 165 |
-
flat_multimap(from_range_t, R&& rg, const key_compare& comp)
|
| 166 |
: flat_multimap(comp) { insert_range(std::forward<R>(rg)); }
|
| 167 |
-
template<container-compatible-range<value_type> R, class Allocator>
|
| 168 |
-
flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Allocator& a);
|
| 169 |
|
| 170 |
-
|
| 171 |
-
flat_multimap(sorted_equivalent_t s, InputIterator first, InputIterator last,
|
| 172 |
const key_compare& comp = key_compare())
|
| 173 |
-
: c(), compare(comp) { insert(s, first, last); }
|
| 174 |
-
template<class InputIterator, class Allocator>
|
| 175 |
-
flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 176 |
-
const key_compare& comp, const Allocator& a);
|
| 177 |
-
template<class InputIterator, class Allocator>
|
| 178 |
-
flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 179 |
-
const Allocator& a);
|
| 180 |
-
|
| 181 |
-
flat_multimap(initializer_list<value_type> il, const key_compare& comp = key_compare())
|
| 182 |
: flat_multimap(il.begin(), il.end(), comp) { }
|
| 183 |
-
template<class Allocator>
|
| 184 |
-
flat_multimap(initializer_list<value_type> il, const key_compare& comp,
|
| 185 |
-
const Allocator& a);
|
| 186 |
-
template<class Allocator>
|
| 187 |
-
flat_multimap(initializer_list<value_type> il, const Allocator& a);
|
| 188 |
|
| 189 |
-
flat_multimap(sorted_equivalent_t
|
| 190 |
const key_compare& comp = key_compare())
|
| 191 |
-
: flat_multimap(
|
| 192 |
-
template<class Allocator>
|
| 193 |
-
flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
|
| 194 |
-
const key_compare& comp, const Allocator& a);
|
| 195 |
-
template<class Allocator>
|
| 196 |
-
flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const Allocator& a);
|
| 197 |
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
// iterators
|
| 201 |
-
iterator begin() noexcept;
|
| 202 |
-
const_iterator begin() const noexcept;
|
| 203 |
-
iterator end() noexcept;
|
| 204 |
-
const_iterator end() const noexcept;
|
| 205 |
|
| 206 |
-
reverse_iterator rbegin() noexcept;
|
| 207 |
-
const_reverse_iterator rbegin() const noexcept;
|
| 208 |
-
reverse_iterator rend() noexcept;
|
| 209 |
-
const_reverse_iterator rend() const noexcept;
|
| 210 |
|
| 211 |
-
const_iterator cbegin() const noexcept;
|
| 212 |
-
const_iterator cend() const noexcept;
|
| 213 |
-
const_reverse_iterator crbegin() const noexcept;
|
| 214 |
-
const_reverse_iterator crend() const noexcept;
|
| 215 |
|
| 216 |
// capacity
|
| 217 |
-
|
| 218 |
-
size_type size() const noexcept;
|
| 219 |
-
size_type max_size() const noexcept;
|
| 220 |
|
| 221 |
// modifiers
|
| 222 |
-
template<class... Args> iterator emplace(Args&&... args);
|
| 223 |
template<class... Args>
|
| 224 |
-
iterator emplace_hint(const_iterator position, Args&&... args);
|
| 225 |
|
| 226 |
-
iterator insert(const value_type& x)
|
| 227 |
{ return emplace(x); }
|
| 228 |
-
iterator insert(value_type&& x)
|
| 229 |
{ return emplace(std::move(x)); }
|
| 230 |
-
iterator insert(const_iterator position, const value_type& x)
|
| 231 |
{ return emplace_hint(position, x); }
|
| 232 |
-
iterator insert(const_iterator position, value_type&& x)
|
| 233 |
{ return emplace_hint(position, std::move(x)); }
|
| 234 |
|
| 235 |
-
template<class P> iterator insert(P&& x);
|
| 236 |
template<class P>
|
| 237 |
-
iterator insert(const_iterator position, P&&);
|
| 238 |
template<class InputIterator>
|
| 239 |
-
void insert(InputIterator first, InputIterator last);
|
| 240 |
template<class InputIterator>
|
| 241 |
-
void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
|
| 242 |
template<container-compatible-range<value_type> R>
|
| 243 |
-
void insert_range(R&& rg);
|
| 244 |
|
| 245 |
-
void insert(initializer_list<value_type> il)
|
| 246 |
{ insert(il.begin(), il.end()); }
|
| 247 |
-
void insert(sorted_equivalent_t
|
| 248 |
-
{ insert(
|
| 249 |
|
| 250 |
-
containers extract() &&;
|
| 251 |
-
void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
|
| 252 |
|
| 253 |
-
iterator erase(iterator position);
|
| 254 |
-
iterator erase(const_iterator position);
|
| 255 |
-
size_type erase(const key_type& x);
|
| 256 |
-
template<class K> size_type erase(K&& x);
|
| 257 |
-
iterator erase(const_iterator first, const_iterator last);
|
| 258 |
|
| 259 |
-
void swap(flat_multimap&) noexcept;
|
| 260 |
-
void clear() noexcept;
|
| 261 |
|
| 262 |
// observers
|
| 263 |
-
key_compare key_comp() const;
|
| 264 |
-
value_compare value_comp() const;
|
| 265 |
|
| 266 |
-
const key_container_type& keys() const noexcept { return c.keys; }
|
| 267 |
-
const mapped_container_type& values() const noexcept { return c.values; }
|
| 268 |
|
| 269 |
// map operations
|
| 270 |
-
iterator find(const key_type& x);
|
| 271 |
-
const_iterator find(const key_type& x) const;
|
| 272 |
-
template<class K> iterator find(const K& x);
|
| 273 |
-
template<class K> const_iterator find(const K& x) const;
|
| 274 |
|
| 275 |
-
size_type count(const key_type& x) const;
|
| 276 |
-
template<class K> size_type count(const K& x) const;
|
| 277 |
|
| 278 |
-
bool contains(const key_type& x) const;
|
| 279 |
-
template<class K> bool contains(const K& x) const;
|
| 280 |
|
| 281 |
-
iterator lower_bound(const key_type& x);
|
| 282 |
-
const_iterator lower_bound(const key_type& x) const;
|
| 283 |
-
template<class K> iterator lower_bound(const K& x);
|
| 284 |
-
template<class K> const_iterator lower_bound(const K& x) const;
|
| 285 |
|
| 286 |
-
iterator upper_bound(const key_type& x);
|
| 287 |
-
const_iterator upper_bound(const key_type& x) const;
|
| 288 |
-
template<class K> iterator upper_bound(const K& x);
|
| 289 |
-
template<class K> const_iterator upper_bound(const K& x) const;
|
| 290 |
|
| 291 |
-
pair<iterator, iterator> equal_range(const key_type& x);
|
| 292 |
-
pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
|
| 293 |
template<class K>
|
| 294 |
-
pair<iterator, iterator> equal_range(const K& x);
|
| 295 |
template<class K>
|
| 296 |
-
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 297 |
|
| 298 |
-
friend bool operator==(const flat_multimap& x, const flat_multimap& y);
|
| 299 |
|
| 300 |
-
friend synth-three-way-result<value_type>
|
| 301 |
operator<=>(const flat_multimap& x, const flat_multimap& y);
|
| 302 |
|
| 303 |
-
friend void swap(flat_multimap& x, flat_multimap& y) noexcept
|
| 304 |
{ x.swap(y); }
|
| 305 |
|
| 306 |
private:
|
| 307 |
containers c; // exposition only
|
| 308 |
key_compare compare; // exposition only
|
|
@@ -385,119 +398,122 @@ specified above. It has no base classes or members other than those
|
|
| 385 |
specified.
|
| 386 |
|
| 387 |
#### Constructors <a id="flat.multimap.cons">[[flat.multimap.cons]]</a>
|
| 388 |
|
| 389 |
``` cpp
|
| 390 |
-
flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont,
|
| 391 |
const key_compare& comp = key_compare());
|
| 392 |
```
|
| 393 |
|
| 394 |
-
*Effects:* Initializes `c.keys` with `std::move(key_cont)`,
|
| 395 |
-
with `std::move(mapped_cont)`, and
|
| 396 |
-
range \[`begin()`, `end()`) with respect to `value_comp()`.
|
| 397 |
|
| 398 |
*Complexity:* Linear in N if the container arguments are already sorted
|
| 399 |
with respect to `value_comp()` and otherwise N log N, where N is the
|
| 400 |
value of `key_cont.size()` before this call.
|
| 401 |
|
| 402 |
``` cpp
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
template<class Allocator>
|
| 407 |
-
flat_multimap(const key_container_type& key_cont, const mapped_container_type& mapped_cont,
|
| 408 |
-
const key_compare& comp, const Allocator& a);
|
| 409 |
```
|
| 410 |
|
| 411 |
-
*
|
| 412 |
-
`
|
| 413 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
|
| 415 |
*Effects:* Equivalent to `flat_multimap(key_cont, mapped_cont)` and
|
| 416 |
`flat_multimap(key_cont, mapped_cont, comp)`, respectively, except that
|
| 417 |
-
`c.keys` and `c.values` are constructed with uses-allocator
|
| 418 |
construction [[allocator.uses.construction]].
|
| 419 |
|
| 420 |
*Complexity:* Same as `flat_multimap(key_cont, mapped_cont)` and
|
| 421 |
`flat_multimap(key_cont, mapped_cont, comp)`, respectively.
|
| 422 |
|
| 423 |
``` cpp
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
with `std::move(mapped_cont)`, and `compare` with `comp`.
|
| 430 |
-
|
| 431 |
-
*Complexity:* Constant.
|
| 432 |
-
|
| 433 |
-
``` cpp
|
| 434 |
-
template<class Allocator>
|
| 435 |
-
flat_multimap(sorted_equivalent_t s, const key_container_type& key_cont,
|
| 436 |
-
const mapped_container_type& mapped_cont, const Allocator& a);
|
| 437 |
-
template<class Allocator>
|
| 438 |
-
flat_multimap(sorted_equivalent_t s, const key_container_type& key_cont,
|
| 439 |
const mapped_container_type& mapped_cont, const key_compare& comp,
|
| 440 |
-
const
|
| 441 |
```
|
| 442 |
|
| 443 |
-
*
|
| 444 |
-
`
|
| 445 |
-
`
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
`flat_multimap(s, key_cont, mapped_cont, comp)`, respectively, except
|
| 449 |
-
that `c.keys` and `c.values` are constructed with uses-allocator
|
| 450 |
construction [[allocator.uses.construction]].
|
| 451 |
|
| 452 |
*Complexity:* Linear.
|
| 453 |
|
| 454 |
``` cpp
|
| 455 |
-
template<class
|
| 456 |
-
flat_multimap(const
|
| 457 |
-
template<class
|
| 458 |
-
|
| 459 |
-
template<class
|
| 460 |
-
flat_multimap(
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
template<class InputIterator, class
|
| 469 |
-
flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 470 |
-
|
| 471 |
-
template<class InputIterator, class
|
| 472 |
-
flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 473 |
-
|
| 474 |
-
template<class
|
| 475 |
-
flat_multimap(
|
| 476 |
-
template<class
|
| 477 |
-
flat_multimap(
|
| 478 |
-
template<class
|
| 479 |
-
flat_multimap(
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
```
|
| 484 |
|
| 485 |
-
*Constraints:* `uses_allocator_v<key_container_type, Allocator>` is
|
| 486 |
-
`true` and `uses_allocator_v<mapped_container_type, Allocator>` is
|
| 487 |
-
`true`.
|
| 488 |
-
|
| 489 |
*Effects:* Equivalent to the corresponding non-allocator constructors
|
| 490 |
-
except that `c.keys` and `c.values` are constructed with
|
| 491 |
-
construction [[allocator.uses.construction]].
|
| 492 |
|
| 493 |
#### Erasure <a id="flat.multimap.erasure">[[flat.multimap.erasure]]</a>
|
| 494 |
|
| 495 |
``` cpp
|
| 496 |
template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
|
| 497 |
class Predicate>
|
| 498 |
-
typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type
|
| 499 |
erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
|
| 500 |
```
|
| 501 |
|
| 502 |
*Preconditions:* `Key` and `T` meet the *Cpp17MoveAssignable*
|
| 503 |
requirements.
|
|
|
|
| 69 |
|
| 70 |
The effect of calling a constructor that takes both `key_container_type`
|
| 71 |
and `mapped_container_type` arguments with containers of different sizes
|
| 72 |
is undefined.
|
| 73 |
|
| 74 |
+
The effect of calling a member function that takes a
|
| 75 |
`sorted_equivalent_t` argument with a container, containers, or range
|
| 76 |
that are not sorted with respect to `key_comp()` is undefined.
|
| 77 |
|
| 78 |
+
The types `iterator` and `const_iterator` meet the constexpr iterator
|
| 79 |
+
requirements [[iterator.requirements.general]].
|
| 80 |
+
|
| 81 |
#### Definition <a id="flat.multimap.defn">[[flat.multimap.defn]]</a>
|
| 82 |
|
| 83 |
``` cpp
|
| 84 |
namespace std {
|
| 85 |
template<class Key, class T, class Compare = less<Key>,
|
|
|
|
| 103 |
using mapped_container_type = MappedContainer;
|
| 104 |
|
| 105 |
class value_compare {
|
| 106 |
private:
|
| 107 |
key_compare comp; // exposition only
|
| 108 |
+
constexpr value_compare(key_compare c) : comp(c) { } // exposition only
|
| 109 |
|
| 110 |
public:
|
| 111 |
+
constexpr bool operator()(const_reference x, const_reference y) const {
|
| 112 |
return comp(x.first, y.first);
|
| 113 |
}
|
| 114 |
};
|
| 115 |
|
| 116 |
struct containers {
|
| 117 |
key_container_type keys;
|
| 118 |
mapped_container_type values;
|
| 119 |
};
|
| 120 |
|
| 121 |
+
// [flat.multimap.cons], constructors
|
| 122 |
+
constexpr flat_multimap() : flat_multimap(key_compare()) { }
|
| 123 |
|
| 124 |
+
constexpr explicit flat_multimap(const key_compare& comp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
: c(), compare(comp) { }
|
| 126 |
+
|
| 127 |
+
constexpr flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont,
|
| 128 |
+
const key_compare& comp = key_compare());
|
| 129 |
+
|
| 130 |
+
constexpr flat_multimap(sorted_equivalent_t,
|
| 131 |
+
key_container_type key_cont, mapped_container_type mapped_cont,
|
| 132 |
+
const key_compare& comp = key_compare());
|
| 133 |
|
| 134 |
template<class InputIterator>
|
| 135 |
+
constexpr flat_multimap(InputIterator first, InputIterator last,
|
| 136 |
const key_compare& comp = key_compare())
|
| 137 |
: c(), compare(comp)
|
| 138 |
{ insert(first, last); }
|
| 139 |
+
|
| 140 |
+
template<class InputIterator>
|
| 141 |
+
constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 142 |
+
const key_compare& comp = key_compare())
|
| 143 |
+
: c(), compare(comp) { insert(sorted_equivalent, first, last); }
|
| 144 |
|
| 145 |
template<container-compatible-range<value_type> R>
|
| 146 |
+
constexpr flat_multimap(from_range_t, R&& rg)
|
| 147 |
+
: flat_multimap(from_range, std::forward<R>(rg), key_compare()) { }
|
|
|
|
|
|
|
| 148 |
template<container-compatible-range<value_type> R>
|
| 149 |
+
constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp)
|
| 150 |
: flat_multimap(comp) { insert_range(std::forward<R>(rg)); }
|
|
|
|
|
|
|
| 151 |
|
| 152 |
+
constexpr flat_multimap(initializer_list<value_type> il,
|
|
|
|
| 153 |
const key_compare& comp = key_compare())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
: flat_multimap(il.begin(), il.end(), comp) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
+
constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
|
| 157 |
const key_compare& comp = key_compare())
|
| 158 |
+
: flat_multimap(sorted_equivalent, il.begin(), il.end(), comp) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
|
| 160 |
+
// [flat.multimap.cons.alloc], constructors with allocators
|
| 161 |
+
|
| 162 |
+
template<class Alloc>
|
| 163 |
+
constexpr explicit flat_multimap(const Alloc& a);
|
| 164 |
+
template<class Alloc>
|
| 165 |
+
constexpr flat_multimap(const key_compare& comp, const Alloc& a);
|
| 166 |
+
template<class Alloc>
|
| 167 |
+
constexpr flat_multimap(const key_container_type& key_cont,
|
| 168 |
+
const mapped_container_type& mapped_cont, const Alloc& a);
|
| 169 |
+
template<class Alloc>
|
| 170 |
+
constexpr flat_multimap(const key_container_type& key_cont,
|
| 171 |
+
const mapped_container_type& mapped_cont,
|
| 172 |
+
const key_compare& comp, const Alloc& a);
|
| 173 |
+
template<class Alloc>
|
| 174 |
+
constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
| 175 |
+
const mapped_container_type& mapped_cont, const Alloc& a);
|
| 176 |
+
template<class Alloc>
|
| 177 |
+
constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
| 178 |
+
const mapped_container_type& mapped_cont,
|
| 179 |
+
const key_compare& comp, const Alloc& a);
|
| 180 |
+
template<class Alloc>
|
| 181 |
+
constexpr flat_multimap(const flat_multimap&, const Alloc& a);
|
| 182 |
+
template<class Alloc>
|
| 183 |
+
constexpr flat_multimap(flat_multimap&&, const Alloc& a);
|
| 184 |
+
template<class InputIterator, class Alloc>
|
| 185 |
+
constexpr flat_multimap(InputIterator first, InputIterator last, const Alloc& a);
|
| 186 |
+
template<class InputIterator, class Alloc>
|
| 187 |
+
constexpr flat_multimap(InputIterator first, InputIterator last,
|
| 188 |
+
const key_compare& comp, const Alloc& a);
|
| 189 |
+
template<class InputIterator, class Alloc>
|
| 190 |
+
constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 191 |
+
const Alloc& a);
|
| 192 |
+
template<class InputIterator, class Alloc>
|
| 193 |
+
constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 194 |
+
const key_compare& comp, const Alloc& a);
|
| 195 |
+
template<container-compatible-range<value_type> R, class Alloc>
|
| 196 |
+
constexpr flat_multimap(from_range_t, R&& rg, const Alloc& a);
|
| 197 |
+
template<container-compatible-range<value_type> R, class Alloc>
|
| 198 |
+
constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
|
| 199 |
+
template<class Alloc>
|
| 200 |
+
constexpr flat_multimap(initializer_list<value_type> il, const Alloc& a);
|
| 201 |
+
template<class Alloc>
|
| 202 |
+
constexpr flat_multimap(initializer_list<value_type> il, const key_compare& comp,
|
| 203 |
+
const Alloc& a);
|
| 204 |
+
template<class Alloc>
|
| 205 |
+
constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
|
| 206 |
+
const Alloc& a);
|
| 207 |
+
template<class Alloc>
|
| 208 |
+
constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
|
| 209 |
+
const key_compare& comp, const Alloc& a);
|
| 210 |
+
|
| 211 |
+
flat_multimap& operator=(initializer_list<value_type>);
|
| 212 |
|
| 213 |
// iterators
|
| 214 |
+
constexpr iterator begin() noexcept;
|
| 215 |
+
constexpr const_iterator begin() const noexcept;
|
| 216 |
+
constexpr iterator end() noexcept;
|
| 217 |
+
constexpr const_iterator end() const noexcept;
|
| 218 |
|
| 219 |
+
constexpr reverse_iterator rbegin() noexcept;
|
| 220 |
+
constexpr const_reverse_iterator rbegin() const noexcept;
|
| 221 |
+
constexpr reverse_iterator rend() noexcept;
|
| 222 |
+
constexpr const_reverse_iterator rend() const noexcept;
|
| 223 |
|
| 224 |
+
constexpr const_iterator cbegin() const noexcept;
|
| 225 |
+
constexpr const_iterator cend() const noexcept;
|
| 226 |
+
constexpr const_reverse_iterator crbegin() const noexcept;
|
| 227 |
+
constexpr const_reverse_iterator crend() const noexcept;
|
| 228 |
|
| 229 |
// capacity
|
| 230 |
+
constexpr bool empty() const noexcept;
|
| 231 |
+
constexpr size_type size() const noexcept;
|
| 232 |
+
constexpr size_type max_size() const noexcept;
|
| 233 |
|
| 234 |
// modifiers
|
| 235 |
+
template<class... Args> constexpr iterator emplace(Args&&... args);
|
| 236 |
template<class... Args>
|
| 237 |
+
constexpr iterator emplace_hint(const_iterator position, Args&&... args);
|
| 238 |
|
| 239 |
+
constexpr iterator insert(const value_type& x)
|
| 240 |
{ return emplace(x); }
|
| 241 |
+
constexpr iterator insert(value_type&& x)
|
| 242 |
{ return emplace(std::move(x)); }
|
| 243 |
+
constexpr iterator insert(const_iterator position, const value_type& x)
|
| 244 |
{ return emplace_hint(position, x); }
|
| 245 |
+
constexpr iterator insert(const_iterator position, value_type&& x)
|
| 246 |
{ return emplace_hint(position, std::move(x)); }
|
| 247 |
|
| 248 |
+
template<class P> constexpr iterator insert(P&& x);
|
| 249 |
template<class P>
|
| 250 |
+
constexpr iterator insert(const_iterator position, P&&);
|
| 251 |
template<class InputIterator>
|
| 252 |
+
constexpr void insert(InputIterator first, InputIterator last);
|
| 253 |
template<class InputIterator>
|
| 254 |
+
constexpr void insert(sorted_equivalent_t, InputIterator first, InputIterator last);
|
| 255 |
template<container-compatible-range<value_type> R>
|
| 256 |
+
constexpr void insert_range(R&& rg);
|
| 257 |
|
| 258 |
+
constexpr void insert(initializer_list<value_type> il)
|
| 259 |
{ insert(il.begin(), il.end()); }
|
| 260 |
+
constexpr void insert(sorted_equivalent_t, initializer_list<value_type> il)
|
| 261 |
+
{ insert(sorted_equivalent, il.begin(), il.end()); }
|
| 262 |
|
| 263 |
+
constexpr containers extract() &&;
|
| 264 |
+
constexpr void replace(key_container_type&& key_cont, mapped_container_type&& mapped_cont);
|
| 265 |
|
| 266 |
+
constexpr iterator erase(iterator position);
|
| 267 |
+
constexpr iterator erase(const_iterator position);
|
| 268 |
+
constexpr size_type erase(const key_type& x);
|
| 269 |
+
template<class K> constexpr size_type erase(K&& x);
|
| 270 |
+
constexpr iterator erase(const_iterator first, const_iterator last);
|
| 271 |
|
| 272 |
+
constexpr void swap(flat_multimap&) noexcept;
|
| 273 |
+
constexpr void clear() noexcept;
|
| 274 |
|
| 275 |
// observers
|
| 276 |
+
constexpr key_compare key_comp() const;
|
| 277 |
+
constexpr value_compare value_comp() const;
|
| 278 |
|
| 279 |
+
constexpr const key_container_type& keys() const noexcept { return c.keys; }
|
| 280 |
+
constexpr const mapped_container_type& values() const noexcept { return c.values; }
|
| 281 |
|
| 282 |
// map operations
|
| 283 |
+
constexpr iterator find(const key_type& x);
|
| 284 |
+
constexpr const_iterator find(const key_type& x) const;
|
| 285 |
+
template<class K> constexpr iterator find(const K& x);
|
| 286 |
+
template<class K> constexpr const_iterator find(const K& x) const;
|
| 287 |
|
| 288 |
+
constexpr size_type count(const key_type& x) const;
|
| 289 |
+
template<class K> constexpr size_type count(const K& x) const;
|
| 290 |
|
| 291 |
+
constexpr bool contains(const key_type& x) const;
|
| 292 |
+
template<class K> constexpr bool contains(const K& x) const;
|
| 293 |
|
| 294 |
+
constexpr iterator lower_bound(const key_type& x);
|
| 295 |
+
constexpr const_iterator lower_bound(const key_type& x) const;
|
| 296 |
+
template<class K> constexpr iterator lower_bound(const K& x);
|
| 297 |
+
template<class K> constexpr const_iterator lower_bound(const K& x) const;
|
| 298 |
|
| 299 |
+
constexpr iterator upper_bound(const key_type& x);
|
| 300 |
+
constexpr const_iterator upper_bound(const key_type& x) const;
|
| 301 |
+
template<class K> constexpr iterator upper_bound(const K& x);
|
| 302 |
+
template<class K> constexpr const_iterator upper_bound(const K& x) const;
|
| 303 |
|
| 304 |
+
constexpr pair<iterator, iterator> equal_range(const key_type& x);
|
| 305 |
+
constexpr pair<const_iterator, const_iterator> equal_range(const key_type& x) const;
|
| 306 |
template<class K>
|
| 307 |
+
constexpr pair<iterator, iterator> equal_range(const K& x);
|
| 308 |
template<class K>
|
| 309 |
+
constexpr pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 310 |
|
| 311 |
+
friend constexpr bool operator==(const flat_multimap& x, const flat_multimap& y);
|
| 312 |
|
| 313 |
+
friend constexpr synth-three-way-result<value_type>
|
| 314 |
operator<=>(const flat_multimap& x, const flat_multimap& y);
|
| 315 |
|
| 316 |
+
friend constexpr void swap(flat_multimap& x, flat_multimap& y) noexcept
|
| 317 |
{ x.swap(y); }
|
| 318 |
|
| 319 |
private:
|
| 320 |
containers c; // exposition only
|
| 321 |
key_compare compare; // exposition only
|
|
|
|
| 398 |
specified.
|
| 399 |
|
| 400 |
#### Constructors <a id="flat.multimap.cons">[[flat.multimap.cons]]</a>
|
| 401 |
|
| 402 |
``` cpp
|
| 403 |
+
constexpr flat_multimap(key_container_type key_cont, mapped_container_type mapped_cont,
|
| 404 |
const key_compare& comp = key_compare());
|
| 405 |
```
|
| 406 |
|
| 407 |
+
*Effects:* Initializes *`c`*`.keys` with `std::move(key_cont)`,
|
| 408 |
+
*`c`*`.values` with `std::move(mapped_cont)`, and *compare* with `comp`;
|
| 409 |
+
sorts the range \[`begin()`, `end()`) with respect to `value_comp()`.
|
| 410 |
|
| 411 |
*Complexity:* Linear in N if the container arguments are already sorted
|
| 412 |
with respect to `value_comp()` and otherwise N log N, where N is the
|
| 413 |
value of `key_cont.size()` before this call.
|
| 414 |
|
| 415 |
``` cpp
|
| 416 |
+
constexpr flat_multimap(sorted_equivalent_t, key_container_type key_cont,
|
| 417 |
+
mapped_container_type mapped_cont,
|
| 418 |
+
const key_compare& comp = key_compare());
|
|
|
|
|
|
|
|
|
|
| 419 |
```
|
| 420 |
|
| 421 |
+
*Effects:* Initializes *`c`*`.keys` with `std::move(key_cont)`,
|
| 422 |
+
*`c`*`.values` with `std::move(mapped_cont)`, and *compare* with `comp`.
|
| 423 |
+
|
| 424 |
+
*Complexity:* Constant.
|
| 425 |
+
|
| 426 |
+
#### Constructors with allocators <a id="flat.multimap.cons.alloc">[[flat.multimap.cons.alloc]]</a>
|
| 427 |
+
|
| 428 |
+
The constructors in this subclause shall not participate in overload
|
| 429 |
+
resolution unless `uses_allocator_v<key_container_type, Alloc>` is
|
| 430 |
+
`true` and `uses_allocator_v<mapped_container_type, Alloc>` is `true`.
|
| 431 |
+
|
| 432 |
+
``` cpp
|
| 433 |
+
template<class Alloc>
|
| 434 |
+
constexpr flat_multimap(const key_container_type& key_cont,
|
| 435 |
+
const mapped_container_type& mapped_cont, const Alloc& a);
|
| 436 |
+
template<class Alloc>
|
| 437 |
+
constexpr flat_multimap(const key_container_type& key_cont,
|
| 438 |
+
const mapped_container_type& mapped_cont,
|
| 439 |
+
const key_compare& comp, const Alloc& a);
|
| 440 |
+
```
|
| 441 |
|
| 442 |
*Effects:* Equivalent to `flat_multimap(key_cont, mapped_cont)` and
|
| 443 |
`flat_multimap(key_cont, mapped_cont, comp)`, respectively, except that
|
| 444 |
+
*`c`*`.keys` and *`c`*`.values` are constructed with uses-allocator
|
| 445 |
construction [[allocator.uses.construction]].
|
| 446 |
|
| 447 |
*Complexity:* Same as `flat_multimap(key_cont, mapped_cont)` and
|
| 448 |
`flat_multimap(key_cont, mapped_cont, comp)`, respectively.
|
| 449 |
|
| 450 |
``` cpp
|
| 451 |
+
template<class Alloc>
|
| 452 |
+
constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
| 453 |
+
const mapped_container_type& mapped_cont, const Alloc& a);
|
| 454 |
+
template<class Alloc>
|
| 455 |
+
constexpr flat_multimap(sorted_equivalent_t, const key_container_type& key_cont,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
const mapped_container_type& mapped_cont, const key_compare& comp,
|
| 457 |
+
const Alloc& a);
|
| 458 |
```
|
| 459 |
|
| 460 |
+
*Effects:* Equivalent to
|
| 461 |
+
`flat_multimap(sorted_equivalent, key_cont, mapped_cont)` and
|
| 462 |
+
`flat_multimap(sorted_equivalent, key_cont, mapped_cont, comp)`,
|
| 463 |
+
respectively, except that *`c`*`.keys` and *`c`*`.values` are
|
| 464 |
+
constructed with uses-allocator
|
|
|
|
|
|
|
| 465 |
construction [[allocator.uses.construction]].
|
| 466 |
|
| 467 |
*Complexity:* Linear.
|
| 468 |
|
| 469 |
``` cpp
|
| 470 |
+
template<class Alloc>
|
| 471 |
+
constexpr explicit flat_multimap(const Alloc& a);
|
| 472 |
+
template<class Alloc>
|
| 473 |
+
constexpr flat_multimap(const key_compare& comp, const Alloc& a);
|
| 474 |
+
template<class Alloc>
|
| 475 |
+
constexpr flat_multimap(const flat_multimap&, const Alloc& a);
|
| 476 |
+
template<class Alloc>
|
| 477 |
+
constexpr flat_multimap(flat_multimap&&, const Alloc& a);
|
| 478 |
+
template<class InputIterator, class Alloc>
|
| 479 |
+
constexpr flat_multimap(InputIterator first, InputIterator last, const Alloc& a);
|
| 480 |
+
template<class InputIterator, class Alloc>
|
| 481 |
+
constexpr flat_multimap(InputIterator first, InputIterator last, const key_compare& comp,
|
| 482 |
+
const Alloc& a);
|
| 483 |
+
template<class InputIterator, class Alloc>
|
| 484 |
+
constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 485 |
+
const Alloc& a);
|
| 486 |
+
template<class InputIterator, class Alloc>
|
| 487 |
+
constexpr flat_multimap(sorted_equivalent_t, InputIterator first, InputIterator last,
|
| 488 |
+
const key_compare& comp, const Alloc& a);
|
| 489 |
+
template<container-compatible-range<value_type> R, class Alloc>
|
| 490 |
+
constexpr flat_multimap(from_range_t, R&& rg, const Alloc& a);
|
| 491 |
+
template<container-compatible-range<value_type> R, class Alloc>
|
| 492 |
+
constexpr flat_multimap(from_range_t, R&& rg, const key_compare& comp, const Alloc& a);
|
| 493 |
+
template<class Alloc>
|
| 494 |
+
constexpr flat_multimap(initializer_list<value_type> il, const Alloc& a);
|
| 495 |
+
template<class Alloc>
|
| 496 |
+
constexpr flat_multimap(initializer_list<value_type> il, const key_compare& comp,
|
| 497 |
+
const Alloc& a);
|
| 498 |
+
template<class Alloc>
|
| 499 |
+
constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il, const Alloc& a);
|
| 500 |
+
template<class Alloc>
|
| 501 |
+
constexpr flat_multimap(sorted_equivalent_t, initializer_list<value_type> il,
|
| 502 |
+
const key_compare& comp, const Alloc& a);
|
| 503 |
```
|
| 504 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
*Effects:* Equivalent to the corresponding non-allocator constructors
|
| 506 |
+
except that *`c`*`.keys` and *`c`*`.values` are constructed with
|
| 507 |
+
uses-allocator construction [[allocator.uses.construction]].
|
| 508 |
|
| 509 |
#### Erasure <a id="flat.multimap.erasure">[[flat.multimap.erasure]]</a>
|
| 510 |
|
| 511 |
``` cpp
|
| 512 |
template<class Key, class T, class Compare, class KeyContainer, class MappedContainer,
|
| 513 |
class Predicate>
|
| 514 |
+
constexpr typename flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>::size_type
|
| 515 |
erase_if(flat_multimap<Key, T, Compare, KeyContainer, MappedContainer>& c, Predicate pred);
|
| 516 |
```
|
| 517 |
|
| 518 |
*Preconditions:* `Key` and `T` meet the *Cpp17MoveAssignable*
|
| 519 |
requirements.
|