- tmp/tmpuursfdfr/{from.md → to.md} +249 -87
tmp/tmpuursfdfr/{from.md → to.md}
RENAMED
|
@@ -5,11 +5,12 @@
|
|
| 5 |
The header `<unordered_map>` defines the class templates `unordered_map`
|
| 6 |
and `unordered_multimap`; the header `<unordered_set>` defines the class
|
| 7 |
templates `unordered_set` and `unordered_multiset`.
|
| 8 |
|
| 9 |
The exposition-only alias templates *`iter-value-type`*,
|
| 10 |
-
*`iter-key-type`*, *`iter-mapped-type`*,
|
|
|
|
| 11 |
defined in [[associative.general]] may appear in deduction guides for
|
| 12 |
unordered containers.
|
| 13 |
|
| 14 |
### Header `<unordered_map>` synopsis <a id="unord.map.syn">[[unord.map.syn]]</a>
|
| 15 |
|
|
@@ -50,14 +51,16 @@ namespace std {
|
|
| 50 |
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 51 |
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
| 52 |
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
| 53 |
noexcept(noexcept(x.swap(y)));
|
| 54 |
|
|
|
|
| 55 |
template<class K, class T, class H, class P, class A, class Predicate>
|
| 56 |
typename unordered_map<K, T, H, P, A>::size_type
|
| 57 |
erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred);
|
| 58 |
|
|
|
|
| 59 |
template<class K, class T, class H, class P, class A, class Predicate>
|
| 60 |
typename unordered_multimap<K, T, H, P, A>::size_type
|
| 61 |
erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred);
|
| 62 |
|
| 63 |
namespace pmr {
|
|
@@ -117,14 +120,16 @@ namespace std {
|
|
| 117 |
template<class Key, class Hash, class Pred, class Alloc>
|
| 118 |
void swap(unordered_multiset<Key, Hash, Pred, Alloc>& x,
|
| 119 |
unordered_multiset<Key, Hash, Pred, Alloc>& y)
|
| 120 |
noexcept(noexcept(x.swap(y)));
|
| 121 |
|
|
|
|
| 122 |
template<class K, class H, class P, class A, class Predicate>
|
| 123 |
typename unordered_set<K, H, P, A>::size_type
|
| 124 |
erase_if(unordered_set<K, H, P, A>& c, Predicate pred);
|
| 125 |
|
|
|
|
| 126 |
template<class K, class H, class P, class A, class Predicate>
|
| 127 |
typename unordered_multiset<K, H, P, A>::size_type
|
| 128 |
erase_if(unordered_multiset<K, H, P, A>& c, Predicate pred);
|
| 129 |
|
| 130 |
namespace pmr {
|
|
@@ -150,18 +155,18 @@ namespace std {
|
|
| 150 |
An `unordered_map` is an unordered associative container that supports
|
| 151 |
unique keys (an `unordered_map` contains at most one of each key value)
|
| 152 |
and that associates values of another type `mapped_type` with the keys.
|
| 153 |
The `unordered_map` class supports forward iterators.
|
| 154 |
|
| 155 |
-
An `unordered_map` meets all of the requirements of a container
|
| 156 |
-
|
| 157 |
-
[[container.alloc.
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
`
|
| 161 |
-
`Key
|
| 162 |
-
`pair<const Key, T>`.
|
| 163 |
|
| 164 |
Subclause [[unord.map]] only describes operations on `unordered_map`
|
| 165 |
that are not described in one of the requirement tables, or for which
|
| 166 |
there is additional semantic information.
|
| 167 |
|
|
@@ -183,12 +188,12 @@ namespace std {
|
|
| 183 |
using allocator_type = Allocator;
|
| 184 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 185 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 186 |
using reference = value_type&;
|
| 187 |
using const_reference = const value_type&;
|
| 188 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 189 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 190 |
|
| 191 |
using iterator = implementation-defined // type of unordered_map::iterator; // see [container.requirements]
|
| 192 |
using const_iterator = implementation-defined // type of unordered_map::const_iterator; // see [container.requirements]
|
| 193 |
using local_iterator = implementation-defined // type of unordered_map::local_iterator; // see [container.requirements]
|
| 194 |
using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
|
|
@@ -205,15 +210,20 @@ namespace std {
|
|
| 205 |
unordered_map(InputIterator f, InputIterator l,
|
| 206 |
size_type n = see below,
|
| 207 |
const hasher& hf = hasher(),
|
| 208 |
const key_equal& eql = key_equal(),
|
| 209 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 210 |
unordered_map(const unordered_map&);
|
| 211 |
unordered_map(unordered_map&&);
|
| 212 |
explicit unordered_map(const Allocator&);
|
| 213 |
-
unordered_map(const unordered_map&, const Allocator&);
|
| 214 |
-
unordered_map(unordered_map&&, const Allocator&);
|
| 215 |
unordered_map(initializer_list<value_type> il,
|
| 216 |
size_type n = see below,
|
| 217 |
const hasher& hf = hasher(),
|
| 218 |
const key_equal& eql = key_equal(),
|
| 219 |
const allocator_type& a = allocator_type());
|
|
@@ -226,10 +236,16 @@ namespace std {
|
|
| 226 |
: unordered_map(f, l, n, hasher(), key_equal(), a) { }
|
| 227 |
template<class InputIterator>
|
| 228 |
unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 229 |
const allocator_type& a)
|
| 230 |
: unordered_map(f, l, n, hf, key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 232 |
: unordered_map(il, n, hasher(), key_equal(), a) { }
|
| 233 |
unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 234 |
const allocator_type& a)
|
| 235 |
: unordered_map(il, n, hf, key_equal(), a) { }
|
|
@@ -263,14 +279,17 @@ namespace std {
|
|
| 263 |
template<class P> pair<iterator, bool> insert(P&& obj);
|
| 264 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 265 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 266 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 267 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 268 |
void insert(initializer_list<value_type>);
|
| 269 |
|
| 270 |
node_type extract(const_iterator position);
|
| 271 |
node_type extract(const key_type& x);
|
|
|
|
| 272 |
insert_return_type insert(node_type&& nh);
|
| 273 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 274 |
|
| 275 |
template<class... Args>
|
| 276 |
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
|
@@ -290,10 +309,11 @@ namespace std {
|
|
| 290 |
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 291 |
|
| 292 |
iterator erase(iterator position);
|
| 293 |
iterator erase(const_iterator position);
|
| 294 |
size_type erase(const key_type& k);
|
|
|
|
| 295 |
iterator erase(const_iterator first, const_iterator last);
|
| 296 |
void swap(unordered_map&)
|
| 297 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 298 |
is_nothrow_swappable_v<Hash> &&
|
| 299 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -317,11 +337,10 @@ namespace std {
|
|
| 317 |
const_iterator find(const key_type& k) const;
|
| 318 |
template<class K>
|
| 319 |
iterator find(const K& k);
|
| 320 |
template<class K>
|
| 321 |
const_iterator find(const K& k) const;
|
| 322 |
-
template<class K>
|
| 323 |
size_type count(const key_type& k) const;
|
| 324 |
template<class K>
|
| 325 |
size_type count(const K& k) const;
|
| 326 |
bool contains(const key_type& k) const;
|
| 327 |
template<class K>
|
|
@@ -366,10 +385,17 @@ namespace std {
|
|
| 366 |
unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 367 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 368 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash, Pred,
|
| 369 |
Allocator>;
|
| 370 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 371 |
template<class Key, class T, class Hash = hash<Key>,
|
| 372 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 373 |
unordered_map(initializer_list<pair<Key, T>>,
|
| 374 |
typename see below::size_type = see below, Hash = Hash(),
|
| 375 |
Pred = Pred(), Allocator = Allocator())
|
|
@@ -390,10 +416,25 @@ namespace std {
|
|
| 390 |
template<class InputIterator, class Hash, class Allocator>
|
| 391 |
unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
|
| 392 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 393 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
template<class Key, class T, class Allocator>
|
| 396 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 397 |
Allocator)
|
| 398 |
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 399 |
|
|
@@ -403,16 +444,10 @@ namespace std {
|
|
| 403 |
|
| 404 |
template<class Key, class T, class Hash, class Allocator>
|
| 405 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type, Hash,
|
| 406 |
Allocator)
|
| 407 |
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
|
| 408 |
-
|
| 409 |
-
// swap
|
| 410 |
-
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 411 |
-
void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
|
| 412 |
-
unordered_map<Key, T, Hash, Pred, Alloc>& y)
|
| 413 |
-
noexcept(noexcept(x.swap(y)));
|
| 414 |
}
|
| 415 |
```
|
| 416 |
|
| 417 |
A `size_type` parameter type in an `unordered_map` deduction guide
|
| 418 |
refers to the `size_type` member type of the type deduced by the
|
|
@@ -440,10 +475,16 @@ template<class InputIterator>
|
|
| 440 |
unordered_map(InputIterator f, InputIterator l,
|
| 441 |
size_type n = see below,
|
| 442 |
const hasher& hf = hasher(),
|
| 443 |
const key_equal& eql = key_equal(),
|
| 444 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 445 |
unordered_map(initializer_list<value_type> il,
|
| 446 |
size_type n = see below,
|
| 447 |
const hasher& hf = hasher(),
|
| 448 |
const key_equal& eql = key_equal(),
|
| 449 |
const allocator_type& a = allocator_type());
|
|
@@ -451,12 +492,11 @@ unordered_map(initializer_list<value_type> il,
|
|
| 451 |
|
| 452 |
*Effects:* Constructs an empty `unordered_map` using the specified hash
|
| 453 |
function, key equality predicate, and allocator, and using at least `n`
|
| 454 |
buckets. If `n` is not provided, the number of buckets is
|
| 455 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 456 |
-
`l`)
|
| 457 |
-
for the second form. `max_load_factor()` returns `1.0`.
|
| 458 |
|
| 459 |
*Complexity:* Average case linear, worst case quadratic.
|
| 460 |
|
| 461 |
#### Element access <a id="unord.map.elem">[[unord.map.elem]]</a>
|
| 462 |
|
|
@@ -468,11 +508,12 @@ mapped_type& operator[](const key_type& k);
|
|
| 468 |
|
| 469 |
``` cpp
|
| 470 |
mapped_type& operator[](key_type&& k);
|
| 471 |
```
|
| 472 |
|
| 473 |
-
*Effects:* Equivalent to:
|
|
|
|
| 474 |
|
| 475 |
``` cpp
|
| 476 |
mapped_type& at(const key_type& k);
|
| 477 |
const mapped_type& at(const key_type& k) const;
|
| 478 |
```
|
|
@@ -626,18 +667,18 @@ An `unordered_multimap` is an unordered associative container that
|
|
| 626 |
supports equivalent keys (an instance of `unordered_multimap` may
|
| 627 |
contain multiple copies of each key value) and that associates values of
|
| 628 |
another type `mapped_type` with the keys. The `unordered_multimap` class
|
| 629 |
supports forward iterators.
|
| 630 |
|
| 631 |
-
An `unordered_multimap` meets all of the requirements of a container
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
the `
|
| 637 |
-
|
| 638 |
-
`pair<const Key, T>`.
|
| 639 |
|
| 640 |
Subclause [[unord.multimap]] only describes operations on
|
| 641 |
`unordered_multimap` that are not described in one of the requirement
|
| 642 |
tables, or for which there is additional semantic information.
|
| 643 |
|
|
@@ -659,12 +700,12 @@ namespace std {
|
|
| 659 |
using allocator_type = Allocator;
|
| 660 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 661 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 662 |
using reference = value_type&;
|
| 663 |
using const_reference = const value_type&;
|
| 664 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 665 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 666 |
|
| 667 |
using iterator = implementation-defined // type of unordered_multimap::iterator; // see [container.requirements]
|
| 668 |
using const_iterator = implementation-defined // type of unordered_multimap::const_iterator; // see [container.requirements]
|
| 669 |
using local_iterator = implementation-defined // type of unordered_multimap::local_iterator; // see [container.requirements]
|
| 670 |
using const_local_iterator = implementation-defined // type of unordered_multimap::const_local_iterator; // see [container.requirements]
|
|
@@ -680,15 +721,21 @@ namespace std {
|
|
| 680 |
unordered_multimap(InputIterator f, InputIterator l,
|
| 681 |
size_type n = see below,
|
| 682 |
const hasher& hf = hasher(),
|
| 683 |
const key_equal& eql = key_equal(),
|
| 684 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 685 |
unordered_multimap(const unordered_multimap&);
|
| 686 |
unordered_multimap(unordered_multimap&&);
|
| 687 |
explicit unordered_multimap(const Allocator&);
|
| 688 |
-
unordered_multimap(const unordered_multimap&, const Allocator&);
|
| 689 |
-
unordered_multimap(unordered_multimap&&, const Allocator&);
|
| 690 |
unordered_multimap(initializer_list<value_type> il,
|
| 691 |
size_type n = see below,
|
| 692 |
const hasher& hf = hasher(),
|
| 693 |
const key_equal& eql = key_equal(),
|
| 694 |
const allocator_type& a = allocator_type());
|
|
@@ -701,10 +748,18 @@ namespace std {
|
|
| 701 |
: unordered_multimap(f, l, n, hasher(), key_equal(), a) { }
|
| 702 |
template<class InputIterator>
|
| 703 |
unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 704 |
const allocator_type& a)
|
| 705 |
: unordered_multimap(f, l, n, hf, key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 706 |
unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 707 |
: unordered_multimap(il, n, hasher(), key_equal(), a) { }
|
| 708 |
unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 709 |
const allocator_type& a)
|
| 710 |
: unordered_multimap(il, n, hf, key_equal(), a) { }
|
|
@@ -738,20 +793,24 @@ namespace std {
|
|
| 738 |
template<class P> iterator insert(P&& obj);
|
| 739 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 740 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 741 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 742 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 743 |
void insert(initializer_list<value_type>);
|
| 744 |
|
| 745 |
node_type extract(const_iterator position);
|
| 746 |
node_type extract(const key_type& x);
|
|
|
|
| 747 |
iterator insert(node_type&& nh);
|
| 748 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 749 |
|
| 750 |
iterator erase(iterator position);
|
| 751 |
iterator erase(const_iterator position);
|
| 752 |
size_type erase(const key_type& k);
|
|
|
|
| 753 |
iterator erase(const_iterator first, const_iterator last);
|
| 754 |
void swap(unordered_multimap&)
|
| 755 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 756 |
is_nothrow_swappable_v<Hash> &&
|
| 757 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -818,10 +877,18 @@ namespace std {
|
|
| 818 |
typename see below::size_type = see below,
|
| 819 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 820 |
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 821 |
Hash, Pred, Allocator>;
|
| 822 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
template<class Key, class T, class Hash = hash<Key>,
|
| 824 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 825 |
unordered_multimap(initializer_list<pair<Key, T>>,
|
| 826 |
typename see below::size_type = see below,
|
| 827 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
|
@@ -843,10 +910,25 @@ namespace std {
|
|
| 843 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash,
|
| 844 |
Allocator)
|
| 845 |
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 846 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 847 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
template<class Key, class T, class Allocator>
|
| 849 |
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 850 |
Allocator)
|
| 851 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 852 |
|
|
@@ -856,16 +938,10 @@ namespace std {
|
|
| 856 |
|
| 857 |
template<class Key, class T, class Hash, class Allocator>
|
| 858 |
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 859 |
Hash, Allocator)
|
| 860 |
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;
|
| 861 |
-
|
| 862 |
-
// swap
|
| 863 |
-
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 864 |
-
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
| 865 |
-
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
| 866 |
-
noexcept(noexcept(x.swap(y)));
|
| 867 |
}
|
| 868 |
```
|
| 869 |
|
| 870 |
A `size_type` parameter type in an `unordered_multimap` deduction guide
|
| 871 |
refers to the `size_type` member type of the type deduced by the
|
|
@@ -893,10 +969,16 @@ template<class InputIterator>
|
|
| 893 |
unordered_multimap(InputIterator f, InputIterator l,
|
| 894 |
size_type n = see below,
|
| 895 |
const hasher& hf = hasher(),
|
| 896 |
const key_equal& eql = key_equal(),
|
| 897 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 898 |
unordered_multimap(initializer_list<value_type> il,
|
| 899 |
size_type n = see below,
|
| 900 |
const hasher& hf = hasher(),
|
| 901 |
const key_equal& eql = key_equal(),
|
| 902 |
const allocator_type& a = allocator_type());
|
|
@@ -904,12 +986,11 @@ unordered_multimap(initializer_list<value_type> il,
|
|
| 904 |
|
| 905 |
*Effects:* Constructs an empty `unordered_multimap` using the specified
|
| 906 |
hash function, key equality predicate, and allocator, and using at least
|
| 907 |
`n` buckets. If `n` is not provided, the number of buckets is
|
| 908 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 909 |
-
`l`)
|
| 910 |
-
for the second form. `max_load_factor()` returns `1.0`.
|
| 911 |
|
| 912 |
*Complexity:* Average case linear, worst case quadratic.
|
| 913 |
|
| 914 |
#### Modifiers <a id="unord.multimap.modifiers">[[unord.multimap.modifiers]]</a>
|
| 915 |
|
|
@@ -961,19 +1042,19 @@ return original_size - c.size();
|
|
| 961 |
An `unordered_set` is an unordered associative container that supports
|
| 962 |
unique keys (an `unordered_set` contains at most one of each key value)
|
| 963 |
and in which the elements’ keys are the elements themselves. The
|
| 964 |
`unordered_set` class supports forward iterators.
|
| 965 |
|
| 966 |
-
An `unordered_set` meets all of the requirements of a container
|
| 967 |
-
|
| 968 |
-
[[container.alloc.
|
| 969 |
-
|
| 970 |
-
|
| 971 |
-
`
|
| 972 |
-
|
| 973 |
-
|
| 974 |
-
same type.
|
| 975 |
|
| 976 |
Subclause [[unord.set]] only describes operations on `unordered_set`
|
| 977 |
that are not described in one of the requirement tables, or for which
|
| 978 |
there is additional semantic information.
|
| 979 |
|
|
@@ -993,12 +1074,12 @@ namespace std {
|
|
| 993 |
using allocator_type = Allocator;
|
| 994 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 995 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 996 |
using reference = value_type&;
|
| 997 |
using const_reference = const value_type&;
|
| 998 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 999 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 1000 |
|
| 1001 |
using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
|
| 1002 |
using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
|
| 1003 |
using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
|
| 1004 |
using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
|
|
@@ -1015,15 +1096,21 @@ namespace std {
|
|
| 1015 |
unordered_set(InputIterator f, InputIterator l,
|
| 1016 |
size_type n = see below,
|
| 1017 |
const hasher& hf = hasher(),
|
| 1018 |
const key_equal& eql = key_equal(),
|
| 1019 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1020 |
unordered_set(const unordered_set&);
|
| 1021 |
unordered_set(unordered_set&&);
|
| 1022 |
explicit unordered_set(const Allocator&);
|
| 1023 |
-
unordered_set(const unordered_set&, const Allocator&);
|
| 1024 |
-
unordered_set(unordered_set&&, const Allocator&);
|
| 1025 |
unordered_set(initializer_list<value_type> il,
|
| 1026 |
size_type n = see below,
|
| 1027 |
const hasher& hf = hasher(),
|
| 1028 |
const key_equal& eql = key_equal(),
|
| 1029 |
const allocator_type& a = allocator_type());
|
|
@@ -1038,10 +1125,16 @@ namespace std {
|
|
| 1038 |
unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 1039 |
const allocator_type& a)
|
| 1040 |
: unordered_set(f, l, n, hf, key_equal(), a) { }
|
| 1041 |
unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 1042 |
: unordered_set(il, n, hasher(), key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1043 |
unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 1044 |
const allocator_type& a)
|
| 1045 |
: unordered_set(il, n, hf, key_equal(), a) { }
|
| 1046 |
~unordered_set();
|
| 1047 |
unordered_set& operator=(const unordered_set&);
|
|
@@ -1071,20 +1164,25 @@ namespace std {
|
|
| 1071 |
pair<iterator, bool> insert(const value_type& obj);
|
| 1072 |
pair<iterator, bool> insert(value_type&& obj);
|
| 1073 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 1074 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 1075 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 1076 |
void insert(initializer_list<value_type>);
|
| 1077 |
|
| 1078 |
node_type extract(const_iterator position);
|
| 1079 |
node_type extract(const key_type& x);
|
|
|
|
| 1080 |
insert_return_type insert(node_type&& nh);
|
| 1081 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 1082 |
|
| 1083 |
-
iterator erase(iterator position)
|
|
|
|
| 1084 |
iterator erase(const_iterator position);
|
| 1085 |
size_type erase(const key_type& k);
|
|
|
|
| 1086 |
iterator erase(const_iterator first, const_iterator last);
|
| 1087 |
void swap(unordered_set&)
|
| 1088 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 1089 |
is_nothrow_swappable_v<Hash> &&
|
| 1090 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -1150,10 +1248,18 @@ namespace std {
|
|
| 1150 |
unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 1151 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1152 |
-> unordered_set<iter-value-type<InputIterator>,
|
| 1153 |
Hash, Pred, Allocator>;
|
| 1154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1155 |
template<class T, class Hash = hash<T>,
|
| 1156 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 1157 |
unordered_set(initializer_list<T>, typename see below::size_type = see below,
|
| 1158 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1159 |
-> unordered_set<T, Hash, Pred, Allocator>;
|
|
@@ -1170,23 +1276,32 @@ namespace std {
|
|
| 1170 |
Hash, Allocator)
|
| 1171 |
-> unordered_set<iter-value-type<InputIterator>, Hash,
|
| 1172 |
equal_to<iter-value-type<InputIterator>>,
|
| 1173 |
Allocator>;
|
| 1174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1175 |
template<class T, class Allocator>
|
| 1176 |
unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
|
| 1177 |
-> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
|
| 1178 |
|
| 1179 |
template<class T, class Hash, class Allocator>
|
| 1180 |
unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 1181 |
-> unordered_set<T, Hash, equal_to<T>, Allocator>;
|
| 1182 |
-
|
| 1183 |
-
// swap
|
| 1184 |
-
template<class Key, class Hash, class Pred, class Alloc>
|
| 1185 |
-
void swap(unordered_set<Key, Hash, Pred, Alloc>& x,
|
| 1186 |
-
unordered_set<Key, Hash, Pred, Alloc>& y)
|
| 1187 |
-
noexcept(noexcept(x.swap(y)));
|
| 1188 |
}
|
| 1189 |
```
|
| 1190 |
|
| 1191 |
A `size_type` parameter type in an `unordered_set` deduction guide
|
| 1192 |
refers to the `size_type` member type of the type deduced by the
|
|
@@ -1214,10 +1329,16 @@ template<class InputIterator>
|
|
| 1214 |
unordered_set(InputIterator f, InputIterator l,
|
| 1215 |
size_type n = see below,
|
| 1216 |
const hasher& hf = hasher(),
|
| 1217 |
const key_equal& eql = key_equal(),
|
| 1218 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1219 |
unordered_set(initializer_list<value_type> il,
|
| 1220 |
size_type n = see below,
|
| 1221 |
const hasher& hf = hasher(),
|
| 1222 |
const key_equal& eql = key_equal(),
|
| 1223 |
const allocator_type& a = allocator_type());
|
|
@@ -1225,12 +1346,11 @@ unordered_set(initializer_list<value_type> il,
|
|
| 1225 |
|
| 1226 |
*Effects:* Constructs an empty `unordered_set` using the specified hash
|
| 1227 |
function, key equality predicate, and allocator, and using at least `n`
|
| 1228 |
buckets. If `n` is not provided, the number of buckets is
|
| 1229 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 1230 |
-
`l`)
|
| 1231 |
-
for the second form. `max_load_factor()` returns `1.0`.
|
| 1232 |
|
| 1233 |
*Complexity:* Average case linear, worst case quadratic.
|
| 1234 |
|
| 1235 |
#### Erasure <a id="unord.set.erasure">[[unord.set.erasure]]</a>
|
| 1236 |
|
|
@@ -1262,19 +1382,20 @@ An `unordered_multiset` is an unordered associative container that
|
|
| 1262 |
supports equivalent keys (an instance of `unordered_multiset` may
|
| 1263 |
contain multiple copies of the same key value) and in which each
|
| 1264 |
element’s key is the element itself. The `unordered_multiset` class
|
| 1265 |
supports forward iterators.
|
| 1266 |
|
| 1267 |
-
An `unordered_multiset` meets all of the requirements of a container
|
| 1268 |
-
|
| 1269 |
-
|
| 1270 |
-
|
| 1271 |
-
|
| 1272 |
-
the `
|
| 1273 |
-
|
| 1274 |
-
|
| 1275 |
-
are
|
|
|
|
| 1276 |
|
| 1277 |
Subclause [[unord.multiset]] only describes operations on
|
| 1278 |
`unordered_multiset` that are not described in one of the requirement
|
| 1279 |
tables, or for which there is additional semantic information.
|
| 1280 |
|
|
@@ -1294,12 +1415,12 @@ namespace std {
|
|
| 1294 |
using allocator_type = Allocator;
|
| 1295 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 1296 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 1297 |
using reference = value_type&;
|
| 1298 |
using const_reference = const value_type&;
|
| 1299 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 1300 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 1301 |
|
| 1302 |
using iterator = implementation-defined // type of unordered_multiset::iterator; // see [container.requirements]
|
| 1303 |
using const_iterator = implementation-defined // type of unordered_multiset::const_iterator; // see [container.requirements]
|
| 1304 |
using local_iterator = implementation-defined // type of unordered_multiset::local_iterator; // see [container.requirements]
|
| 1305 |
using const_local_iterator = implementation-defined // type of unordered_multiset::const_local_iterator; // see [container.requirements]
|
|
@@ -1315,15 +1436,21 @@ namespace std {
|
|
| 1315 |
unordered_multiset(InputIterator f, InputIterator l,
|
| 1316 |
size_type n = see below,
|
| 1317 |
const hasher& hf = hasher(),
|
| 1318 |
const key_equal& eql = key_equal(),
|
| 1319 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1320 |
unordered_multiset(const unordered_multiset&);
|
| 1321 |
unordered_multiset(unordered_multiset&&);
|
| 1322 |
explicit unordered_multiset(const Allocator&);
|
| 1323 |
-
unordered_multiset(const unordered_multiset&, const Allocator&);
|
| 1324 |
-
unordered_multiset(unordered_multiset&&, const Allocator&);
|
| 1325 |
unordered_multiset(initializer_list<value_type> il,
|
| 1326 |
size_type n = see below,
|
| 1327 |
const hasher& hf = hasher(),
|
| 1328 |
const key_equal& eql = key_equal(),
|
| 1329 |
const allocator_type& a = allocator_type());
|
|
@@ -1336,10 +1463,18 @@ namespace std {
|
|
| 1336 |
: unordered_multiset(f, l, n, hasher(), key_equal(), a) { }
|
| 1337 |
template<class InputIterator>
|
| 1338 |
unordered_multiset(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 1339 |
const allocator_type& a)
|
| 1340 |
: unordered_multiset(f, l, n, hf, key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1341 |
unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 1342 |
: unordered_multiset(il, n, hasher(), key_equal(), a) { }
|
| 1343 |
unordered_multiset(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 1344 |
const allocator_type& a)
|
| 1345 |
: unordered_multiset(il, n, hf, key_equal(), a) { }
|
|
@@ -1371,20 +1506,25 @@ namespace std {
|
|
| 1371 |
iterator insert(const value_type& obj);
|
| 1372 |
iterator insert(value_type&& obj);
|
| 1373 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 1374 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 1375 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 1376 |
void insert(initializer_list<value_type>);
|
| 1377 |
|
| 1378 |
node_type extract(const_iterator position);
|
| 1379 |
node_type extract(const key_type& x);
|
|
|
|
| 1380 |
iterator insert(node_type&& nh);
|
| 1381 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 1382 |
|
| 1383 |
-
iterator erase(iterator position)
|
|
|
|
| 1384 |
iterator erase(const_iterator position);
|
| 1385 |
size_type erase(const key_type& k);
|
|
|
|
| 1386 |
iterator erase(const_iterator first, const_iterator last);
|
| 1387 |
void swap(unordered_multiset&)
|
| 1388 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 1389 |
is_nothrow_swappable_v<Hash> &&
|
| 1390 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -1450,10 +1590,18 @@ namespace std {
|
|
| 1450 |
unordered_multiset(InputIterator, InputIterator, see below::size_type = see below,
|
| 1451 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1452 |
-> unordered_multiset<iter-value-type<InputIterator>,
|
| 1453 |
Hash, Pred, Allocator>;
|
| 1454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1455 |
template<class T, class Hash = hash<T>,
|
| 1456 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 1457 |
unordered_multiset(initializer_list<T>, typename see below::size_type = see below,
|
| 1458 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1459 |
-> unordered_multiset<T, Hash, Pred, Allocator>;
|
|
@@ -1470,23 +1618,32 @@ namespace std {
|
|
| 1470 |
Hash, Allocator)
|
| 1471 |
-> unordered_multiset<iter-value-type<InputIterator>, Hash,
|
| 1472 |
equal_to<iter-value-type<InputIterator>>,
|
| 1473 |
Allocator>;
|
| 1474 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1475 |
template<class T, class Allocator>
|
| 1476 |
unordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
|
| 1477 |
-> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>;
|
| 1478 |
|
| 1479 |
template<class T, class Hash, class Allocator>
|
| 1480 |
unordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 1481 |
-> unordered_multiset<T, Hash, equal_to<T>, Allocator>;
|
| 1482 |
-
|
| 1483 |
-
// swap
|
| 1484 |
-
template<class Key, class Hash, class Pred, class Alloc>
|
| 1485 |
-
void swap(unordered_multiset<Key, Hash, Pred, Alloc>& x,
|
| 1486 |
-
unordered_multiset<Key, Hash, Pred, Alloc>& y)
|
| 1487 |
-
noexcept(noexcept(x.swap(y)));
|
| 1488 |
}
|
| 1489 |
```
|
| 1490 |
|
| 1491 |
A `size_type` parameter type in an `unordered_multiset` deduction guide
|
| 1492 |
refers to the `size_type` member type of the type deduced by the
|
|
@@ -1514,10 +1671,16 @@ template<class InputIterator>
|
|
| 1514 |
unordered_multiset(InputIterator f, InputIterator l,
|
| 1515 |
size_type n = see below,
|
| 1516 |
const hasher& hf = hasher(),
|
| 1517 |
const key_equal& eql = key_equal(),
|
| 1518 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1519 |
unordered_multiset(initializer_list<value_type> il,
|
| 1520 |
size_type n = see below,
|
| 1521 |
const hasher& hf = hasher(),
|
| 1522 |
const key_equal& eql = key_equal(),
|
| 1523 |
const allocator_type& a = allocator_type());
|
|
@@ -1525,12 +1688,11 @@ unordered_multiset(initializer_list<value_type> il,
|
|
| 1525 |
|
| 1526 |
*Effects:* Constructs an empty `unordered_multiset` using the specified
|
| 1527 |
hash function, key equality predicate, and allocator, and using at least
|
| 1528 |
`n` buckets. If `n` is not provided, the number of buckets is
|
| 1529 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 1530 |
-
`l`)
|
| 1531 |
-
for the second form. `max_load_factor()` returns `1.0`.
|
| 1532 |
|
| 1533 |
*Complexity:* Average case linear, worst case quadratic.
|
| 1534 |
|
| 1535 |
#### Erasure <a id="unord.multiset.erasure">[[unord.multiset.erasure]]</a>
|
| 1536 |
|
|
|
|
| 5 |
The header `<unordered_map>` defines the class templates `unordered_map`
|
| 6 |
and `unordered_multimap`; the header `<unordered_set>` defines the class
|
| 7 |
templates `unordered_set` and `unordered_multiset`.
|
| 8 |
|
| 9 |
The exposition-only alias templates *`iter-value-type`*,
|
| 10 |
+
*`iter-key-type`*, *`iter-mapped-type`*, *`iter-to-alloc-type`*,
|
| 11 |
+
*`range-key-type`*, *`range-mapped-type`*, and *`range-to-alloc-type`*
|
| 12 |
defined in [[associative.general]] may appear in deduction guides for
|
| 13 |
unordered containers.
|
| 14 |
|
| 15 |
### Header `<unordered_map>` synopsis <a id="unord.map.syn">[[unord.map.syn]]</a>
|
| 16 |
|
|
|
|
| 51 |
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 52 |
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
| 53 |
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
| 54 |
noexcept(noexcept(x.swap(y)));
|
| 55 |
|
| 56 |
+
// [unord.map.erasure], erasure for unordered_map
|
| 57 |
template<class K, class T, class H, class P, class A, class Predicate>
|
| 58 |
typename unordered_map<K, T, H, P, A>::size_type
|
| 59 |
erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred);
|
| 60 |
|
| 61 |
+
// [unord.multimap.erasure], erasure for unordered_multimap
|
| 62 |
template<class K, class T, class H, class P, class A, class Predicate>
|
| 63 |
typename unordered_multimap<K, T, H, P, A>::size_type
|
| 64 |
erase_if(unordered_multimap<K, T, H, P, A>& c, Predicate pred);
|
| 65 |
|
| 66 |
namespace pmr {
|
|
|
|
| 120 |
template<class Key, class Hash, class Pred, class Alloc>
|
| 121 |
void swap(unordered_multiset<Key, Hash, Pred, Alloc>& x,
|
| 122 |
unordered_multiset<Key, Hash, Pred, Alloc>& y)
|
| 123 |
noexcept(noexcept(x.swap(y)));
|
| 124 |
|
| 125 |
+
// [unord.set.erasure], erasure for unordered_set
|
| 126 |
template<class K, class H, class P, class A, class Predicate>
|
| 127 |
typename unordered_set<K, H, P, A>::size_type
|
| 128 |
erase_if(unordered_set<K, H, P, A>& c, Predicate pred);
|
| 129 |
|
| 130 |
+
// [unord.multiset.erasure], erasure for unordered_multiset
|
| 131 |
template<class K, class H, class P, class A, class Predicate>
|
| 132 |
typename unordered_multiset<K, H, P, A>::size_type
|
| 133 |
erase_if(unordered_multiset<K, H, P, A>& c, Predicate pred);
|
| 134 |
|
| 135 |
namespace pmr {
|
|
|
|
| 155 |
An `unordered_map` is an unordered associative container that supports
|
| 156 |
unique keys (an `unordered_map` contains at most one of each key value)
|
| 157 |
and that associates values of another type `mapped_type` with the keys.
|
| 158 |
The `unordered_map` class supports forward iterators.
|
| 159 |
|
| 160 |
+
An `unordered_map` meets all of the requirements of a container
|
| 161 |
+
[[container.reqmts]], of an allocator-aware container
|
| 162 |
+
[[container.alloc.reqmts]], and of an unordered associative container
|
| 163 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 164 |
+
requirements table for unique keys; that is, an `unordered_map` supports
|
| 165 |
+
the `a_uniq` operations in that table, not the `a_eq` operations. For an
|
| 166 |
+
`unordered_map<Key, T>` the `key_type` is `Key`, the `mapped_type` is
|
| 167 |
+
`T`, and the `value_type` is `pair<const Key, T>`.
|
| 168 |
|
| 169 |
Subclause [[unord.map]] only describes operations on `unordered_map`
|
| 170 |
that are not described in one of the requirement tables, or for which
|
| 171 |
there is additional semantic information.
|
| 172 |
|
|
|
|
| 188 |
using allocator_type = Allocator;
|
| 189 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 190 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 191 |
using reference = value_type&;
|
| 192 |
using const_reference = const value_type&;
|
| 193 |
+
using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
|
| 194 |
+
using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
|
| 195 |
|
| 196 |
using iterator = implementation-defined // type of unordered_map::iterator; // see [container.requirements]
|
| 197 |
using const_iterator = implementation-defined // type of unordered_map::const_iterator; // see [container.requirements]
|
| 198 |
using local_iterator = implementation-defined // type of unordered_map::local_iterator; // see [container.requirements]
|
| 199 |
using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
|
|
|
|
| 210 |
unordered_map(InputIterator f, InputIterator l,
|
| 211 |
size_type n = see below,
|
| 212 |
const hasher& hf = hasher(),
|
| 213 |
const key_equal& eql = key_equal(),
|
| 214 |
const allocator_type& a = allocator_type());
|
| 215 |
+
|
| 216 |
+
template<container-compatible-range<value_type> R>
|
| 217 |
+
unordered_map(from_range_t, R&& rg, size_type n = see below,
|
| 218 |
+
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
| 219 |
+
const allocator_type& a = allocator_type());
|
| 220 |
unordered_map(const unordered_map&);
|
| 221 |
unordered_map(unordered_map&&);
|
| 222 |
explicit unordered_map(const Allocator&);
|
| 223 |
+
unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
|
| 224 |
+
unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
|
| 225 |
unordered_map(initializer_list<value_type> il,
|
| 226 |
size_type n = see below,
|
| 227 |
const hasher& hf = hasher(),
|
| 228 |
const key_equal& eql = key_equal(),
|
| 229 |
const allocator_type& a = allocator_type());
|
|
|
|
| 236 |
: unordered_map(f, l, n, hasher(), key_equal(), a) { }
|
| 237 |
template<class InputIterator>
|
| 238 |
unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 239 |
const allocator_type& a)
|
| 240 |
: unordered_map(f, l, n, hf, key_equal(), a) { }
|
| 241 |
+
template<container-compatible-range<value_type> R>
|
| 242 |
+
unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 243 |
+
: unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
|
| 244 |
+
template<container-compatible-range<value_type> R>
|
| 245 |
+
unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
|
| 246 |
+
: unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 247 |
unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 248 |
: unordered_map(il, n, hasher(), key_equal(), a) { }
|
| 249 |
unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 250 |
const allocator_type& a)
|
| 251 |
: unordered_map(il, n, hf, key_equal(), a) { }
|
|
|
|
| 279 |
template<class P> pair<iterator, bool> insert(P&& obj);
|
| 280 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 281 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 282 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 283 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
| 284 |
+
template<container-compatible-range<value_type> R>
|
| 285 |
+
void insert_range(R&& rg);
|
| 286 |
void insert(initializer_list<value_type>);
|
| 287 |
|
| 288 |
node_type extract(const_iterator position);
|
| 289 |
node_type extract(const key_type& x);
|
| 290 |
+
template<class K> node_type extract(K&& x);
|
| 291 |
insert_return_type insert(node_type&& nh);
|
| 292 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 293 |
|
| 294 |
template<class... Args>
|
| 295 |
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
|
|
|
| 309 |
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 310 |
|
| 311 |
iterator erase(iterator position);
|
| 312 |
iterator erase(const_iterator position);
|
| 313 |
size_type erase(const key_type& k);
|
| 314 |
+
template<class K> size_type erase(K&& x);
|
| 315 |
iterator erase(const_iterator first, const_iterator last);
|
| 316 |
void swap(unordered_map&)
|
| 317 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 318 |
is_nothrow_swappable_v<Hash> &&
|
| 319 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 337 |
const_iterator find(const key_type& k) const;
|
| 338 |
template<class K>
|
| 339 |
iterator find(const K& k);
|
| 340 |
template<class K>
|
| 341 |
const_iterator find(const K& k) const;
|
|
|
|
| 342 |
size_type count(const key_type& k) const;
|
| 343 |
template<class K>
|
| 344 |
size_type count(const K& k) const;
|
| 345 |
bool contains(const key_type& k) const;
|
| 346 |
template<class K>
|
|
|
|
| 385 |
unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 386 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 387 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash, Pred,
|
| 388 |
Allocator>;
|
| 389 |
|
| 390 |
+
template<ranges::input_range R, class Hash = hash<range-key-type<R>>,
|
| 391 |
+
class Pred = equal_to<range-key-type<R>>,
|
| 392 |
+
class Allocator = allocator<range-to-alloc-type<R>>>
|
| 393 |
+
unordered_map(from_range_t, R&&, typename see below::size_type = see below,
|
| 394 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 395 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, Hash, Pred, Allocator>;
|
| 396 |
+
|
| 397 |
template<class Key, class T, class Hash = hash<Key>,
|
| 398 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 399 |
unordered_map(initializer_list<pair<Key, T>>,
|
| 400 |
typename see below::size_type = see below, Hash = Hash(),
|
| 401 |
Pred = Pred(), Allocator = Allocator())
|
|
|
|
| 416 |
template<class InputIterator, class Hash, class Allocator>
|
| 417 |
unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
|
| 418 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 419 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 420 |
|
| 421 |
+
template<ranges::input_range R, class Allocator>
|
| 422 |
+
unordered_map(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 423 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 424 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 425 |
+
|
| 426 |
+
template<ranges::input_range R, class Allocator>
|
| 427 |
+
unordered_map(from_range_t, R&&, Allocator)
|
| 428 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 429 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 430 |
+
|
| 431 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 432 |
+
unordered_map(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 433 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, Hash,
|
| 434 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 435 |
+
|
| 436 |
template<class Key, class T, class Allocator>
|
| 437 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 438 |
Allocator)
|
| 439 |
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 440 |
|
|
|
|
| 444 |
|
| 445 |
template<class Key, class T, class Hash, class Allocator>
|
| 446 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type, Hash,
|
| 447 |
Allocator)
|
| 448 |
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 449 |
}
|
| 450 |
```
|
| 451 |
|
| 452 |
A `size_type` parameter type in an `unordered_map` deduction guide
|
| 453 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 475 |
unordered_map(InputIterator f, InputIterator l,
|
| 476 |
size_type n = see below,
|
| 477 |
const hasher& hf = hasher(),
|
| 478 |
const key_equal& eql = key_equal(),
|
| 479 |
const allocator_type& a = allocator_type());
|
| 480 |
+
template<container-compatible-range<value_type> R>
|
| 481 |
+
unordered_map(from_range_t, R&& rg,
|
| 482 |
+
size_type n = see below,
|
| 483 |
+
const hasher& hf = hasher(),
|
| 484 |
+
const key_equal& eql = key_equal(),
|
| 485 |
+
const allocator_type& a = allocator_type());
|
| 486 |
unordered_map(initializer_list<value_type> il,
|
| 487 |
size_type n = see below,
|
| 488 |
const hasher& hf = hasher(),
|
| 489 |
const key_equal& eql = key_equal(),
|
| 490 |
const allocator_type& a = allocator_type());
|
|
|
|
| 492 |
|
| 493 |
*Effects:* Constructs an empty `unordered_map` using the specified hash
|
| 494 |
function, key equality predicate, and allocator, and using at least `n`
|
| 495 |
buckets. If `n` is not provided, the number of buckets is
|
| 496 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 497 |
+
`l`), `rg`, or `il`, respectively. `max_load_factor()` returns `1.0`.
|
|
|
|
| 498 |
|
| 499 |
*Complexity:* Average case linear, worst case quadratic.
|
| 500 |
|
| 501 |
#### Element access <a id="unord.map.elem">[[unord.map.elem]]</a>
|
| 502 |
|
|
|
|
| 508 |
|
| 509 |
``` cpp
|
| 510 |
mapped_type& operator[](key_type&& k);
|
| 511 |
```
|
| 512 |
|
| 513 |
+
*Effects:* Equivalent to:
|
| 514 |
+
`return try_emplace(std::move(k)).first->second;`
|
| 515 |
|
| 516 |
``` cpp
|
| 517 |
mapped_type& at(const key_type& k);
|
| 518 |
const mapped_type& at(const key_type& k) const;
|
| 519 |
```
|
|
|
|
| 667 |
supports equivalent keys (an instance of `unordered_multimap` may
|
| 668 |
contain multiple copies of each key value) and that associates values of
|
| 669 |
another type `mapped_type` with the keys. The `unordered_multimap` class
|
| 670 |
supports forward iterators.
|
| 671 |
|
| 672 |
+
An `unordered_multimap` meets all of the requirements of a container
|
| 673 |
+
[[container.reqmts]], of an allocator-aware container
|
| 674 |
+
[[container.alloc.reqmts]], and of an unordered associative container
|
| 675 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 676 |
+
requirements table for equivalent keys; that is, an `unordered_multimap`
|
| 677 |
+
supports the `a_eq` operations in that table, not the `a_uniq`
|
| 678 |
+
operations. For an `unordered_multimap<Key, T>` the `key_type` is `Key`,
|
| 679 |
+
the `mapped_type` is `T`, and the `value_type` is `pair<const Key, T>`.
|
| 680 |
|
| 681 |
Subclause [[unord.multimap]] only describes operations on
|
| 682 |
`unordered_multimap` that are not described in one of the requirement
|
| 683 |
tables, or for which there is additional semantic information.
|
| 684 |
|
|
|
|
| 700 |
using allocator_type = Allocator;
|
| 701 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 702 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 703 |
using reference = value_type&;
|
| 704 |
using const_reference = const value_type&;
|
| 705 |
+
using size_type = implementation-defined // type of unordered_multimap::size_type; // see [container.requirements]
|
| 706 |
+
using difference_type = implementation-defined // type of unordered_multimap::difference_type; // see [container.requirements]
|
| 707 |
|
| 708 |
using iterator = implementation-defined // type of unordered_multimap::iterator; // see [container.requirements]
|
| 709 |
using const_iterator = implementation-defined // type of unordered_multimap::const_iterator; // see [container.requirements]
|
| 710 |
using local_iterator = implementation-defined // type of unordered_multimap::local_iterator; // see [container.requirements]
|
| 711 |
using const_local_iterator = implementation-defined // type of unordered_multimap::const_local_iterator; // see [container.requirements]
|
|
|
|
| 721 |
unordered_multimap(InputIterator f, InputIterator l,
|
| 722 |
size_type n = see below,
|
| 723 |
const hasher& hf = hasher(),
|
| 724 |
const key_equal& eql = key_equal(),
|
| 725 |
const allocator_type& a = allocator_type());
|
| 726 |
+
template<container-compatible-range<value_type> R>
|
| 727 |
+
unordered_multimap(from_range_t, R&& rg,
|
| 728 |
+
size_type n = see below,
|
| 729 |
+
const hasher& hf = hasher(),
|
| 730 |
+
const key_equal& eql = key_equal(),
|
| 731 |
+
const allocator_type& a = allocator_type());
|
| 732 |
unordered_multimap(const unordered_multimap&);
|
| 733 |
unordered_multimap(unordered_multimap&&);
|
| 734 |
explicit unordered_multimap(const Allocator&);
|
| 735 |
+
unordered_multimap(const unordered_multimap&, const type_identity_t<Allocator>&);
|
| 736 |
+
unordered_multimap(unordered_multimap&&, const type_identity_t<Allocator>&);
|
| 737 |
unordered_multimap(initializer_list<value_type> il,
|
| 738 |
size_type n = see below,
|
| 739 |
const hasher& hf = hasher(),
|
| 740 |
const key_equal& eql = key_equal(),
|
| 741 |
const allocator_type& a = allocator_type());
|
|
|
|
| 748 |
: unordered_multimap(f, l, n, hasher(), key_equal(), a) { }
|
| 749 |
template<class InputIterator>
|
| 750 |
unordered_multimap(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 751 |
const allocator_type& a)
|
| 752 |
: unordered_multimap(f, l, n, hf, key_equal(), a) { }
|
| 753 |
+
template<container-compatible-range<value_type> R>
|
| 754 |
+
unordered_multimap(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 755 |
+
: unordered_multimap(from_range, std::forward<R>(rg),
|
| 756 |
+
n, hasher(), key_equal(), a) { }
|
| 757 |
+
template<container-compatible-range<value_type> R>
|
| 758 |
+
unordered_multimap(from_range_t, R&& rg, size_type n, const hasher& hf,
|
| 759 |
+
const allocator_type& a)
|
| 760 |
+
: unordered_multimap(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 761 |
unordered_multimap(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 762 |
: unordered_multimap(il, n, hasher(), key_equal(), a) { }
|
| 763 |
unordered_multimap(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 764 |
const allocator_type& a)
|
| 765 |
: unordered_multimap(il, n, hf, key_equal(), a) { }
|
|
|
|
| 793 |
template<class P> iterator insert(P&& obj);
|
| 794 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 795 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 796 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 797 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
| 798 |
+
template<container-compatible-range<value_type> R>
|
| 799 |
+
void insert_range(R&& rg);
|
| 800 |
void insert(initializer_list<value_type>);
|
| 801 |
|
| 802 |
node_type extract(const_iterator position);
|
| 803 |
node_type extract(const key_type& x);
|
| 804 |
+
template<class K> node_type extract(K&& x);
|
| 805 |
iterator insert(node_type&& nh);
|
| 806 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 807 |
|
| 808 |
iterator erase(iterator position);
|
| 809 |
iterator erase(const_iterator position);
|
| 810 |
size_type erase(const key_type& k);
|
| 811 |
+
template<class K> size_type erase(K&& x);
|
| 812 |
iterator erase(const_iterator first, const_iterator last);
|
| 813 |
void swap(unordered_multimap&)
|
| 814 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 815 |
is_nothrow_swappable_v<Hash> &&
|
| 816 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 877 |
typename see below::size_type = see below,
|
| 878 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 879 |
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 880 |
Hash, Pred, Allocator>;
|
| 881 |
|
| 882 |
+
template<ranges::input_range R,
|
| 883 |
+
class Hash = hash<range-key-type<R>>,
|
| 884 |
+
class Pred = equal_to<range-key-type<R>>,
|
| 885 |
+
class Allocator = allocator<range-to-alloc-type<R>>>
|
| 886 |
+
unordered_multimap(from_range_t, R&&, typename see below::size_type = see below,
|
| 887 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 888 |
+
-> unordered_multimap<range-key-type<R>, range-mapped-type<R>, Hash, Pred, Allocator>;
|
| 889 |
+
|
| 890 |
template<class Key, class T, class Hash = hash<Key>,
|
| 891 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 892 |
unordered_multimap(initializer_list<pair<Key, T>>,
|
| 893 |
typename see below::size_type = see below,
|
| 894 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
|
|
|
| 910 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash,
|
| 911 |
Allocator)
|
| 912 |
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 913 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 914 |
|
| 915 |
+
template<ranges::input_range R, class Allocator>
|
| 916 |
+
unordered_multimap(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 917 |
+
-> unordered_multimap<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 918 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 919 |
+
|
| 920 |
+
template<ranges::input_range R, class Allocator>
|
| 921 |
+
unordered_multimap(from_range_t, R&&, Allocator)
|
| 922 |
+
-> unordered_multimap<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 923 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 924 |
+
|
| 925 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 926 |
+
unordered_multimap(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 927 |
+
-> unordered_multimap<range-key-type<R>, range-mapped-type<R>, Hash,
|
| 928 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 929 |
+
|
| 930 |
template<class Key, class T, class Allocator>
|
| 931 |
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 932 |
Allocator)
|
| 933 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 934 |
|
|
|
|
| 938 |
|
| 939 |
template<class Key, class T, class Hash, class Allocator>
|
| 940 |
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 941 |
Hash, Allocator)
|
| 942 |
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 943 |
}
|
| 944 |
```
|
| 945 |
|
| 946 |
A `size_type` parameter type in an `unordered_multimap` deduction guide
|
| 947 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 969 |
unordered_multimap(InputIterator f, InputIterator l,
|
| 970 |
size_type n = see below,
|
| 971 |
const hasher& hf = hasher(),
|
| 972 |
const key_equal& eql = key_equal(),
|
| 973 |
const allocator_type& a = allocator_type());
|
| 974 |
+
template<container-compatible-range<value_type> R>
|
| 975 |
+
unordered_multimap(from_range_t, R&& rg,
|
| 976 |
+
size_type n = see below,
|
| 977 |
+
const hasher& hf = hasher(),
|
| 978 |
+
const key_equal& eql = key_equal(),
|
| 979 |
+
const allocator_type& a = allocator_type());
|
| 980 |
unordered_multimap(initializer_list<value_type> il,
|
| 981 |
size_type n = see below,
|
| 982 |
const hasher& hf = hasher(),
|
| 983 |
const key_equal& eql = key_equal(),
|
| 984 |
const allocator_type& a = allocator_type());
|
|
|
|
| 986 |
|
| 987 |
*Effects:* Constructs an empty `unordered_multimap` using the specified
|
| 988 |
hash function, key equality predicate, and allocator, and using at least
|
| 989 |
`n` buckets. If `n` is not provided, the number of buckets is
|
| 990 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 991 |
+
`l`), `rg`, or `il`, respectively. `max_load_factor()` returns `1.0`.
|
|
|
|
| 992 |
|
| 993 |
*Complexity:* Average case linear, worst case quadratic.
|
| 994 |
|
| 995 |
#### Modifiers <a id="unord.multimap.modifiers">[[unord.multimap.modifiers]]</a>
|
| 996 |
|
|
|
|
| 1042 |
An `unordered_set` is an unordered associative container that supports
|
| 1043 |
unique keys (an `unordered_set` contains at most one of each key value)
|
| 1044 |
and in which the elements’ keys are the elements themselves. The
|
| 1045 |
`unordered_set` class supports forward iterators.
|
| 1046 |
|
| 1047 |
+
An `unordered_set` meets all of the requirements of a container
|
| 1048 |
+
[[container.reqmts]], of an allocator-aware container
|
| 1049 |
+
[[container.alloc.reqmts]], of an unordered associative container
|
| 1050 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 1051 |
+
requirements table for unique keys; that is, an `unordered_set` supports
|
| 1052 |
+
the `a_uniq` operations in that table, not the `a_eq` operations. For an
|
| 1053 |
+
`unordered_set<Key>` the `key_type` and the `value_type` are both `Key`.
|
| 1054 |
+
The `iterator` and `const_iterator` types are both constant iterator
|
| 1055 |
+
types. It is unspecified whether they are the same type.
|
| 1056 |
|
| 1057 |
Subclause [[unord.set]] only describes operations on `unordered_set`
|
| 1058 |
that are not described in one of the requirement tables, or for which
|
| 1059 |
there is additional semantic information.
|
| 1060 |
|
|
|
|
| 1074 |
using allocator_type = Allocator;
|
| 1075 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 1076 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 1077 |
using reference = value_type&;
|
| 1078 |
using const_reference = const value_type&;
|
| 1079 |
+
using size_type = implementation-defined // type of unordered_set::size_type; // see [container.requirements]
|
| 1080 |
+
using difference_type = implementation-defined // type of unordered_set::difference_type; // see [container.requirements]
|
| 1081 |
|
| 1082 |
using iterator = implementation-defined // type of unordered_set::iterator; // see [container.requirements]
|
| 1083 |
using const_iterator = implementation-defined // type of unordered_set::const_iterator; // see [container.requirements]
|
| 1084 |
using local_iterator = implementation-defined // type of unordered_set::local_iterator; // see [container.requirements]
|
| 1085 |
using const_local_iterator = implementation-defined // type of unordered_set::const_local_iterator; // see [container.requirements]
|
|
|
|
| 1096 |
unordered_set(InputIterator f, InputIterator l,
|
| 1097 |
size_type n = see below,
|
| 1098 |
const hasher& hf = hasher(),
|
| 1099 |
const key_equal& eql = key_equal(),
|
| 1100 |
const allocator_type& a = allocator_type());
|
| 1101 |
+
template<container-compatible-range<value_type> R>
|
| 1102 |
+
unordered_set(from_range_t, R&& rg,
|
| 1103 |
+
size_type n = see below,
|
| 1104 |
+
const hasher& hf = hasher(),
|
| 1105 |
+
const key_equal& eql = key_equal(),
|
| 1106 |
+
const allocator_type& a = allocator_type());
|
| 1107 |
unordered_set(const unordered_set&);
|
| 1108 |
unordered_set(unordered_set&&);
|
| 1109 |
explicit unordered_set(const Allocator&);
|
| 1110 |
+
unordered_set(const unordered_set&, const type_identity_t<Allocator>&);
|
| 1111 |
+
unordered_set(unordered_set&&, const type_identity_t<Allocator>&);
|
| 1112 |
unordered_set(initializer_list<value_type> il,
|
| 1113 |
size_type n = see below,
|
| 1114 |
const hasher& hf = hasher(),
|
| 1115 |
const key_equal& eql = key_equal(),
|
| 1116 |
const allocator_type& a = allocator_type());
|
|
|
|
| 1125 |
unordered_set(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 1126 |
const allocator_type& a)
|
| 1127 |
: unordered_set(f, l, n, hf, key_equal(), a) { }
|
| 1128 |
unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 1129 |
: unordered_set(il, n, hasher(), key_equal(), a) { }
|
| 1130 |
+
template<container-compatible-range<value_type> R>
|
| 1131 |
+
unordered_set(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 1132 |
+
: unordered_set(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
|
| 1133 |
+
template<container-compatible-range<value_type> R>
|
| 1134 |
+
unordered_set(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
|
| 1135 |
+
: unordered_set(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 1136 |
unordered_set(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 1137 |
const allocator_type& a)
|
| 1138 |
: unordered_set(il, n, hf, key_equal(), a) { }
|
| 1139 |
~unordered_set();
|
| 1140 |
unordered_set& operator=(const unordered_set&);
|
|
|
|
| 1164 |
pair<iterator, bool> insert(const value_type& obj);
|
| 1165 |
pair<iterator, bool> insert(value_type&& obj);
|
| 1166 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 1167 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 1168 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
| 1169 |
+
template<container-compatible-range<value_type> R>
|
| 1170 |
+
void insert_range(R&& rg);
|
| 1171 |
void insert(initializer_list<value_type>);
|
| 1172 |
|
| 1173 |
node_type extract(const_iterator position);
|
| 1174 |
node_type extract(const key_type& x);
|
| 1175 |
+
template<class K> node_type extract(K&& x);
|
| 1176 |
insert_return_type insert(node_type&& nh);
|
| 1177 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 1178 |
|
| 1179 |
+
iterator erase(iterator position)
|
| 1180 |
+
requires (!same_as<iterator, const_iterator>);
|
| 1181 |
iterator erase(const_iterator position);
|
| 1182 |
size_type erase(const key_type& k);
|
| 1183 |
+
template<class K> size_type erase(K&& x);
|
| 1184 |
iterator erase(const_iterator first, const_iterator last);
|
| 1185 |
void swap(unordered_set&)
|
| 1186 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 1187 |
is_nothrow_swappable_v<Hash> &&
|
| 1188 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 1248 |
unordered_set(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 1249 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1250 |
-> unordered_set<iter-value-type<InputIterator>,
|
| 1251 |
Hash, Pred, Allocator>;
|
| 1252 |
|
| 1253 |
+
template<ranges::input_range R,
|
| 1254 |
+
class Hash = hash<ranges::range_value_t<R>>,
|
| 1255 |
+
class Pred = equal_to<ranges::range_value_t<R>>,
|
| 1256 |
+
class Allocator = allocator<ranges::range_value_t<R>>>
|
| 1257 |
+
unordered_set(from_range_t, R&&, typename see below::size_type = see below,
|
| 1258 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1259 |
+
-> unordered_set<ranges::range_value_t<R>, Hash, Pred, Allocator>;
|
| 1260 |
+
|
| 1261 |
template<class T, class Hash = hash<T>,
|
| 1262 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 1263 |
unordered_set(initializer_list<T>, typename see below::size_type = see below,
|
| 1264 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1265 |
-> unordered_set<T, Hash, Pred, Allocator>;
|
|
|
|
| 1276 |
Hash, Allocator)
|
| 1277 |
-> unordered_set<iter-value-type<InputIterator>, Hash,
|
| 1278 |
equal_to<iter-value-type<InputIterator>>,
|
| 1279 |
Allocator>;
|
| 1280 |
|
| 1281 |
+
template<ranges::input_range R, class Allocator>
|
| 1282 |
+
unordered_set(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 1283 |
+
-> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 1284 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 1285 |
+
|
| 1286 |
+
template<ranges::input_range R, class Allocator>
|
| 1287 |
+
unordered_set(from_range_t, R&&, Allocator)
|
| 1288 |
+
-> unordered_set<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 1289 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 1290 |
+
|
| 1291 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 1292 |
+
unordered_set(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 1293 |
+
-> unordered_set<ranges::range_value_t<R>, Hash,
|
| 1294 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 1295 |
+
|
| 1296 |
template<class T, class Allocator>
|
| 1297 |
unordered_set(initializer_list<T>, typename see below::size_type, Allocator)
|
| 1298 |
-> unordered_set<T, hash<T>, equal_to<T>, Allocator>;
|
| 1299 |
|
| 1300 |
template<class T, class Hash, class Allocator>
|
| 1301 |
unordered_set(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 1302 |
-> unordered_set<T, Hash, equal_to<T>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1303 |
}
|
| 1304 |
```
|
| 1305 |
|
| 1306 |
A `size_type` parameter type in an `unordered_set` deduction guide
|
| 1307 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 1329 |
unordered_set(InputIterator f, InputIterator l,
|
| 1330 |
size_type n = see below,
|
| 1331 |
const hasher& hf = hasher(),
|
| 1332 |
const key_equal& eql = key_equal(),
|
| 1333 |
const allocator_type& a = allocator_type());
|
| 1334 |
+
template<container-compatible-range<value_type> R>
|
| 1335 |
+
unordered_multiset(from_range_t, R&& rg,
|
| 1336 |
+
size_type n = see below,
|
| 1337 |
+
const hasher& hf = hasher(),
|
| 1338 |
+
const key_equal& eql = key_equal(),
|
| 1339 |
+
const allocator_type& a = allocator_type());
|
| 1340 |
unordered_set(initializer_list<value_type> il,
|
| 1341 |
size_type n = see below,
|
| 1342 |
const hasher& hf = hasher(),
|
| 1343 |
const key_equal& eql = key_equal(),
|
| 1344 |
const allocator_type& a = allocator_type());
|
|
|
|
| 1346 |
|
| 1347 |
*Effects:* Constructs an empty `unordered_set` using the specified hash
|
| 1348 |
function, key equality predicate, and allocator, and using at least `n`
|
| 1349 |
buckets. If `n` is not provided, the number of buckets is
|
| 1350 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 1351 |
+
`l`), `rg`, or `il`, respectively. `max_load_factor()` returns `1.0`.
|
|
|
|
| 1352 |
|
| 1353 |
*Complexity:* Average case linear, worst case quadratic.
|
| 1354 |
|
| 1355 |
#### Erasure <a id="unord.set.erasure">[[unord.set.erasure]]</a>
|
| 1356 |
|
|
|
|
| 1382 |
supports equivalent keys (an instance of `unordered_multiset` may
|
| 1383 |
contain multiple copies of the same key value) and in which each
|
| 1384 |
element’s key is the element itself. The `unordered_multiset` class
|
| 1385 |
supports forward iterators.
|
| 1386 |
|
| 1387 |
+
An `unordered_multiset` meets all of the requirements of a container
|
| 1388 |
+
[[container.reqmts]], of an allocator-aware container
|
| 1389 |
+
[[container.alloc.reqmts]], and of an unordered associative container
|
| 1390 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 1391 |
+
requirements table for equivalent keys; that is, an `unordered_multiset`
|
| 1392 |
+
supports the `a_eq` operations in that table, not the `a_uniq`
|
| 1393 |
+
operations. For an `unordered_multiset<Key>` the `key_type` and the
|
| 1394 |
+
`value_type` are both `Key`. The `iterator` and `const_iterator` types
|
| 1395 |
+
are both constant iterator types. It is unspecified whether they are the
|
| 1396 |
+
same type.
|
| 1397 |
|
| 1398 |
Subclause [[unord.multiset]] only describes operations on
|
| 1399 |
`unordered_multiset` that are not described in one of the requirement
|
| 1400 |
tables, or for which there is additional semantic information.
|
| 1401 |
|
|
|
|
| 1415 |
using allocator_type = Allocator;
|
| 1416 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 1417 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 1418 |
using reference = value_type&;
|
| 1419 |
using const_reference = const value_type&;
|
| 1420 |
+
using size_type = implementation-defined // type of unordered_multiset::size_type; // see [container.requirements]
|
| 1421 |
+
using difference_type = implementation-defined // type of unordered_multiset::difference_type; // see [container.requirements]
|
| 1422 |
|
| 1423 |
using iterator = implementation-defined // type of unordered_multiset::iterator; // see [container.requirements]
|
| 1424 |
using const_iterator = implementation-defined // type of unordered_multiset::const_iterator; // see [container.requirements]
|
| 1425 |
using local_iterator = implementation-defined // type of unordered_multiset::local_iterator; // see [container.requirements]
|
| 1426 |
using const_local_iterator = implementation-defined // type of unordered_multiset::const_local_iterator; // see [container.requirements]
|
|
|
|
| 1436 |
unordered_multiset(InputIterator f, InputIterator l,
|
| 1437 |
size_type n = see below,
|
| 1438 |
const hasher& hf = hasher(),
|
| 1439 |
const key_equal& eql = key_equal(),
|
| 1440 |
const allocator_type& a = allocator_type());
|
| 1441 |
+
template<container-compatible-range<value_type> R>
|
| 1442 |
+
unordered_multiset(from_range_t, R&& rg,
|
| 1443 |
+
size_type n = see below,
|
| 1444 |
+
const hasher& hf = hasher(),
|
| 1445 |
+
const key_equal& eql = key_equal(),
|
| 1446 |
+
const allocator_type& a = allocator_type());
|
| 1447 |
unordered_multiset(const unordered_multiset&);
|
| 1448 |
unordered_multiset(unordered_multiset&&);
|
| 1449 |
explicit unordered_multiset(const Allocator&);
|
| 1450 |
+
unordered_multiset(const unordered_multiset&, const type_identity_t<Allocator>&);
|
| 1451 |
+
unordered_multiset(unordered_multiset&&, const type_identity_t<Allocator>&);
|
| 1452 |
unordered_multiset(initializer_list<value_type> il,
|
| 1453 |
size_type n = see below,
|
| 1454 |
const hasher& hf = hasher(),
|
| 1455 |
const key_equal& eql = key_equal(),
|
| 1456 |
const allocator_type& a = allocator_type());
|
|
|
|
| 1463 |
: unordered_multiset(f, l, n, hasher(), key_equal(), a) { }
|
| 1464 |
template<class InputIterator>
|
| 1465 |
unordered_multiset(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 1466 |
const allocator_type& a)
|
| 1467 |
: unordered_multiset(f, l, n, hf, key_equal(), a) { }
|
| 1468 |
+
template<container-compatible-range<value_type> R>
|
| 1469 |
+
unordered_multiset(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 1470 |
+
: unordered_multiset(from_range, std::forward<R>(rg),
|
| 1471 |
+
n, hasher(), key_equal(), a) { }
|
| 1472 |
+
template<container-compatible-range<value_type> R>
|
| 1473 |
+
unordered_multiset(from_range_t, R&& rg, size_type n, const hasher& hf,
|
| 1474 |
+
const allocator_type& a)
|
| 1475 |
+
: unordered_multiset(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 1476 |
unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 1477 |
: unordered_multiset(il, n, hasher(), key_equal(), a) { }
|
| 1478 |
unordered_multiset(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 1479 |
const allocator_type& a)
|
| 1480 |
: unordered_multiset(il, n, hf, key_equal(), a) { }
|
|
|
|
| 1506 |
iterator insert(const value_type& obj);
|
| 1507 |
iterator insert(value_type&& obj);
|
| 1508 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 1509 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 1510 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
| 1511 |
+
template<container-compatible-range<value_type> R>
|
| 1512 |
+
void insert_range(R&& rg);
|
| 1513 |
void insert(initializer_list<value_type>);
|
| 1514 |
|
| 1515 |
node_type extract(const_iterator position);
|
| 1516 |
node_type extract(const key_type& x);
|
| 1517 |
+
template<class K> node_type extract(K&& x);
|
| 1518 |
iterator insert(node_type&& nh);
|
| 1519 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 1520 |
|
| 1521 |
+
iterator erase(iterator position)
|
| 1522 |
+
requires (!same_as<iterator, const_iterator>);
|
| 1523 |
iterator erase(const_iterator position);
|
| 1524 |
size_type erase(const key_type& k);
|
| 1525 |
+
template<class K> size_type erase(K&& x);
|
| 1526 |
iterator erase(const_iterator first, const_iterator last);
|
| 1527 |
void swap(unordered_multiset&)
|
| 1528 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 1529 |
is_nothrow_swappable_v<Hash> &&
|
| 1530 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 1590 |
unordered_multiset(InputIterator, InputIterator, see below::size_type = see below,
|
| 1591 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1592 |
-> unordered_multiset<iter-value-type<InputIterator>,
|
| 1593 |
Hash, Pred, Allocator>;
|
| 1594 |
|
| 1595 |
+
template<ranges::input_range R,
|
| 1596 |
+
class Hash = hash<ranges::range_value_t<R>>,
|
| 1597 |
+
class Pred = equal_to<ranges::range_value_t<R>>,
|
| 1598 |
+
class Allocator = allocator<ranges::range_value_t<R>>>
|
| 1599 |
+
unordered_multiset(from_range_t, R&&, typename see below::size_type = see below,
|
| 1600 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1601 |
+
-> unordered_multiset<ranges::range_value_t<R>, Hash, Pred, Allocator>;
|
| 1602 |
+
|
| 1603 |
template<class T, class Hash = hash<T>,
|
| 1604 |
class Pred = equal_to<T>, class Allocator = allocator<T>>
|
| 1605 |
unordered_multiset(initializer_list<T>, typename see below::size_type = see below,
|
| 1606 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 1607 |
-> unordered_multiset<T, Hash, Pred, Allocator>;
|
|
|
|
| 1618 |
Hash, Allocator)
|
| 1619 |
-> unordered_multiset<iter-value-type<InputIterator>, Hash,
|
| 1620 |
equal_to<iter-value-type<InputIterator>>,
|
| 1621 |
Allocator>;
|
| 1622 |
|
| 1623 |
+
template<ranges::input_range R, class Allocator>
|
| 1624 |
+
unordered_multiset(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 1625 |
+
-> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 1626 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 1627 |
+
|
| 1628 |
+
template<ranges::input_range R, class Allocator>
|
| 1629 |
+
unordered_multiset(from_range_t, R&&, Allocator)
|
| 1630 |
+
-> unordered_multiset<ranges::range_value_t<R>, hash<ranges::range_value_t<R>>,
|
| 1631 |
+
equal_to<ranges::range_value_t<R>>, Allocator>;
|
| 1632 |
+
|
| 1633 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 1634 |
+
unordered_multiset(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 1635 |
+
-> unordered_multiset<ranges::range_value_t<R>, Hash, equal_to<ranges::range_value_t<R>>,
|
| 1636 |
+
Allocator>;
|
| 1637 |
+
|
| 1638 |
template<class T, class Allocator>
|
| 1639 |
unordered_multiset(initializer_list<T>, typename see below::size_type, Allocator)
|
| 1640 |
-> unordered_multiset<T, hash<T>, equal_to<T>, Allocator>;
|
| 1641 |
|
| 1642 |
template<class T, class Hash, class Allocator>
|
| 1643 |
unordered_multiset(initializer_list<T>, typename see below::size_type, Hash, Allocator)
|
| 1644 |
-> unordered_multiset<T, Hash, equal_to<T>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1645 |
}
|
| 1646 |
```
|
| 1647 |
|
| 1648 |
A `size_type` parameter type in an `unordered_multiset` deduction guide
|
| 1649 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 1671 |
unordered_multiset(InputIterator f, InputIterator l,
|
| 1672 |
size_type n = see below,
|
| 1673 |
const hasher& hf = hasher(),
|
| 1674 |
const key_equal& eql = key_equal(),
|
| 1675 |
const allocator_type& a = allocator_type());
|
| 1676 |
+
template<container-compatible-range<value_type> R>
|
| 1677 |
+
unordered_multiset(from_range_t, R&& rg,
|
| 1678 |
+
size_type n = see below,
|
| 1679 |
+
const hasher& hf = hasher(),
|
| 1680 |
+
const key_equal& eql = key_equal(),
|
| 1681 |
+
const allocator_type& a = allocator_type());
|
| 1682 |
unordered_multiset(initializer_list<value_type> il,
|
| 1683 |
size_type n = see below,
|
| 1684 |
const hasher& hf = hasher(),
|
| 1685 |
const key_equal& eql = key_equal(),
|
| 1686 |
const allocator_type& a = allocator_type());
|
|
|
|
| 1688 |
|
| 1689 |
*Effects:* Constructs an empty `unordered_multiset` using the specified
|
| 1690 |
hash function, key equality predicate, and allocator, and using at least
|
| 1691 |
`n` buckets. If `n` is not provided, the number of buckets is
|
| 1692 |
*implementation-defined*. Then inserts elements from the range \[`f`,
|
| 1693 |
+
`l`), `rg`, or `il`, respectively. `max_load_factor()` returns `1.0`.
|
|
|
|
| 1694 |
|
| 1695 |
*Complexity:* Average case linear, worst case quadratic.
|
| 1696 |
|
| 1697 |
#### Erasure <a id="unord.multiset.erasure">[[unord.multiset.erasure]]</a>
|
| 1698 |
|