From Jason Turner

[unord.map]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpbyoo56b8/{from.md → to.md} +229 -135
tmp/tmpbyoo56b8/{from.md → to.md} RENAMED
@@ -18,10 +18,13 @@ the `a_uniq` operations in that table, not the `a_eq` operations. For an
18
 
19
  Subclause  [[unord.map]] only describes operations on `unordered_map`
20
  that are not described in one of the requirement tables, or for which
21
  there is additional semantic information.
22
 
 
 
 
23
  ``` cpp
24
  namespace std {
25
  template<class Key,
26
  class T,
27
  class Hash = hash<Key>,
@@ -34,12 +37,12 @@ namespace std {
34
  using mapped_type = T;
35
  using value_type = pair<const Key, T>;
36
  using hasher = Hash;
37
  using key_equal = Pred;
38
  using allocator_type = Allocator;
39
- using pointer = typename allocator_traits<Allocator>::pointer;
40
- using const_pointer = typename allocator_traits<Allocator>::const_pointer;
41
  using reference = value_type&;
42
  using const_reference = const value_type&;
43
  using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
44
  using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
45
 
@@ -49,185 +52,197 @@ namespace std {
49
  using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
50
  using node_type = unspecified;
51
  using insert_return_type = insert-return-type<iterator, node_type>;
52
 
53
  // [unord.map.cnstr], construct/copy/destroy
54
- unordered_map();
55
- explicit unordered_map(size_type n,
56
- const hasher& hf = hasher(),
57
  const key_equal& eql = key_equal(),
58
  const allocator_type& a = allocator_type());
59
  template<class InputIterator>
60
- unordered_map(InputIterator f, InputIterator l,
61
- size_type n = see below,
62
- const hasher& hf = hasher(),
63
  const key_equal& eql = key_equal(),
64
  const allocator_type& a = allocator_type());
65
 
66
  template<container-compatible-range<value_type> R>
67
- unordered_map(from_range_t, R&& rg, size_type n = see below,
68
  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
69
  const allocator_type& a = allocator_type());
70
- unordered_map(const unordered_map&);
71
- unordered_map(unordered_map&&);
72
- explicit unordered_map(const Allocator&);
73
- unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
74
- unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
75
- unordered_map(initializer_list<value_type> il,
76
- size_type n = see below,
77
  const hasher& hf = hasher(),
78
  const key_equal& eql = key_equal(),
79
  const allocator_type& a = allocator_type());
80
- unordered_map(size_type n, const allocator_type& a)
81
  : unordered_map(n, hasher(), key_equal(), a) { }
82
- unordered_map(size_type n, const hasher& hf, const allocator_type& a)
83
  : unordered_map(n, hf, key_equal(), a) { }
84
  template<class InputIterator>
85
- unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
 
86
  : unordered_map(f, l, n, hasher(), key_equal(), a) { }
87
  template<class InputIterator>
88
- unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
89
  const allocator_type& a)
90
  : unordered_map(f, l, n, hf, key_equal(), a) { }
91
  template<container-compatible-range<value_type> R>
92
- unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
93
  : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
94
  template<container-compatible-range<value_type> R>
95
- unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
 
96
  : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
97
- unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
 
98
  : unordered_map(il, n, hasher(), key_equal(), a) { }
99
- unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
100
  const allocator_type& a)
101
  : unordered_map(il, n, hf, key_equal(), a) { }
102
- ~unordered_map();
103
- unordered_map& operator=(const unordered_map&);
104
- unordered_map& operator=(unordered_map&&)
105
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
106
  is_nothrow_move_assignable_v<Hash> &&
107
  is_nothrow_move_assignable_v<Pred>);
108
- unordered_map& operator=(initializer_list<value_type>);
109
- allocator_type get_allocator() const noexcept;
110
 
111
  // iterators
112
- iterator begin() noexcept;
113
- const_iterator begin() const noexcept;
114
- iterator end() noexcept;
115
- const_iterator end() const noexcept;
116
- const_iterator cbegin() const noexcept;
117
- const_iterator cend() const noexcept;
118
 
119
  // capacity
120
- [[nodiscard]] bool empty() const noexcept;
121
- size_type size() const noexcept;
122
- size_type max_size() const noexcept;
123
 
124
  // [unord.map.modifiers], modifiers
125
- template<class... Args> pair<iterator, bool> emplace(Args&&... args);
126
- template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
127
- pair<iterator, bool> insert(const value_type& obj);
128
- pair<iterator, bool> insert(value_type&& obj);
129
- template<class P> pair<iterator, bool> insert(P&& obj);
130
- iterator insert(const_iterator hint, const value_type& obj);
131
- iterator insert(const_iterator hint, value_type&& obj);
132
- template<class P> iterator insert(const_iterator hint, P&& obj);
133
- template<class InputIterator> void insert(InputIterator first, InputIterator last);
 
134
  template<container-compatible-range<value_type> R>
135
- void insert_range(R&& rg);
136
- void insert(initializer_list<value_type>);
137
 
138
- node_type extract(const_iterator position);
139
- node_type extract(const key_type& x);
140
- template<class K> node_type extract(K&& x);
141
- insert_return_type insert(node_type&& nh);
142
- iterator insert(const_iterator hint, node_type&& nh);
143
 
144
  template<class... Args>
145
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
146
  template<class... Args>
147
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
 
 
148
  template<class... Args>
149
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
150
  template<class... Args>
151
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
 
 
152
  template<class M>
153
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
154
  template<class M>
155
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
 
 
156
  template<class M>
157
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
158
  template<class M>
159
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
 
 
160
 
161
- iterator erase(iterator position);
162
- iterator erase(const_iterator position);
163
- size_type erase(const key_type& k);
164
- template<class K> size_type erase(K&& x);
165
- iterator erase(const_iterator first, const_iterator last);
166
- void swap(unordered_map&)
167
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
168
- is_nothrow_swappable_v<Hash> &&
169
- is_nothrow_swappable_v<Pred>);
170
- void clear() noexcept;
171
 
172
  template<class H2, class P2>
173
- void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
174
  template<class H2, class P2>
175
- void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
176
  template<class H2, class P2>
177
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
178
  template<class H2, class P2>
179
- void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
180
 
181
  // observers
182
- hasher hash_function() const;
183
- key_equal key_eq() const;
184
 
185
  // map operations
186
- iterator find(const key_type& k);
187
- const_iterator find(const key_type& k) const;
188
  template<class K>
189
- iterator find(const K& k);
190
  template<class K>
191
- const_iterator find(const K& k) const;
192
- size_type count(const key_type& k) const;
193
  template<class K>
194
- size_type count(const K& k) const;
195
- bool contains(const key_type& k) const;
196
  template<class K>
197
- bool contains(const K& k) const;
198
- pair<iterator, iterator> equal_range(const key_type& k);
199
- pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
200
  template<class K>
201
- pair<iterator, iterator> equal_range(const K& k);
202
  template<class K>
203
- pair<const_iterator, const_iterator> equal_range(const K& k) const;
204
 
205
  // [unord.map.elem], element access
206
- mapped_type& operator[](const key_type& k);
207
- mapped_type& operator[](key_type&& k);
208
- mapped_type& at(const key_type& k);
209
- const mapped_type& at(const key_type& k) const;
 
 
 
210
 
211
  // bucket interface
212
- size_type bucket_count() const noexcept;
213
- size_type max_bucket_count() const noexcept;
214
- size_type bucket_size(size_type n) const;
215
- size_type bucket(const key_type& k) const;
216
- local_iterator begin(size_type n);
217
- const_local_iterator begin(size_type n) const;
218
- local_iterator end(size_type n);
219
- const_local_iterator end(size_type n) const;
220
- const_local_iterator cbegin(size_type n) const;
221
- const_local_iterator cend(size_type n) const;
 
222
 
223
  // hash policy
224
- float load_factor() const noexcept;
225
- float max_load_factor() const noexcept;
226
- void max_load_factor(float z);
227
- void rehash(size_type n);
228
- void reserve(size_type n);
229
  };
230
 
231
  template<class InputIterator,
232
  class Hash = hash<iter-key-type<InputIterator>>,
233
  class Pred = equal_to<iter-key-type<InputIterator>>,
@@ -304,13 +319,12 @@ refers to the `size_type` member type of the type deduced by the
304
  deduction guide.
305
 
306
  #### Constructors <a id="unord.map.cnstr">[[unord.map.cnstr]]</a>
307
 
308
  ``` cpp
309
- unordered_map() : unordered_map(size_type(see below)) { }
310
- explicit unordered_map(size_type n,
311
- const hasher& hf = hasher(),
312
  const key_equal& eql = key_equal(),
313
  const allocator_type& a = allocator_type());
314
  ```
315
 
316
  *Effects:* Constructs an empty `unordered_map` using the specified hash
@@ -320,24 +334,21 @@ buckets. For the default constructor, the number of buckets is
320
 
321
  *Complexity:* Constant.
322
 
323
  ``` cpp
324
  template<class InputIterator>
325
- unordered_map(InputIterator f, InputIterator l,
326
- size_type n = see below,
327
- const hasher& hf = hasher(),
328
  const key_equal& eql = key_equal(),
329
  const allocator_type& a = allocator_type());
330
  template<container-compatible-range<value_type> R>
331
- unordered_map(from_range_t, R&& rg,
332
- size_type n = see below,
333
- const hasher& hf = hasher(),
334
  const key_equal& eql = key_equal(),
335
  const allocator_type& a = allocator_type());
336
- unordered_map(initializer_list<value_type> il,
337
- size_type n = see below,
338
- const hasher& hf = hasher(),
339
  const key_equal& eql = key_equal(),
340
  const allocator_type& a = allocator_type());
341
  ```
342
 
343
  *Effects:* Constructs an empty `unordered_map` using the specified hash
@@ -349,59 +360,85 @@ buckets. If `n` is not provided, the number of buckets is
349
  *Complexity:* Average case linear, worst case quadratic.
350
 
351
  #### Element access <a id="unord.map.elem">[[unord.map.elem]]</a>
352
 
353
  ``` cpp
354
- mapped_type& operator[](const key_type& k);
355
  ```
356
 
357
  *Effects:* Equivalent to: `return try_emplace(k).first->second;`
358
 
359
  ``` cpp
360
- mapped_type& operator[](key_type&& k);
361
  ```
362
 
363
  *Effects:* Equivalent to:
364
  `return try_emplace(std::move(k)).first->second;`
365
 
366
  ``` cpp
367
- mapped_type& at(const key_type& k);
368
- const mapped_type& at(const key_type& k) const;
 
 
 
 
 
 
 
 
 
 
369
  ```
370
 
371
  *Returns:* A reference to `x.second`, where `x` is the (unique) element
372
  whose key is equivalent to `k`.
373
 
374
  *Throws:* An exception object of type `out_of_range` if no such element
375
  is present.
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  #### Modifiers <a id="unord.map.modifiers">[[unord.map.modifiers]]</a>
378
 
379
  ``` cpp
380
  template<class P>
381
- pair<iterator, bool> insert(P&& obj);
382
  ```
383
 
384
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
385
 
386
  *Effects:* Equivalent to: `return emplace(std::forward<P>(obj));`
387
 
388
  ``` cpp
389
  template<class P>
390
- iterator insert(const_iterator hint, P&& obj);
391
  ```
392
 
393
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
394
 
395
  *Effects:* Equivalent to:
396
  `return emplace_hint(hint, std::forward<P>(obj));`
397
 
398
  ``` cpp
399
  template<class... Args>
400
- pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
401
  template<class... Args>
402
- iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
403
  ```
404
 
405
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
406
  `unordered_map` from `piecewise_construct`, `forward_as_tuple(k)`,
407
  `forward_as_tuple(std::forward<Args>(args)...)`.
@@ -417,13 +454,13 @@ iterator points to the map element whose key is equivalent to `k`.
417
 
418
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
419
 
420
  ``` cpp
421
  template<class... Args>
422
- pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
423
  template<class... Args>
424
- iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
425
  ```
426
 
427
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
428
  `unordered_map` from `piecewise_construct`,
429
  `forward_as_tuple(std::move(k))`,
@@ -439,15 +476,44 @@ type `value_type` constructed with `piecewise_construct`,
439
  pair is `true` if and only if the insertion took place. The returned
440
  iterator points to the map element whose key is equivalent to `k`.
441
 
442
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
  ``` cpp
445
  template<class M>
446
- pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
447
  template<class M>
448
- iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
449
  ```
450
 
451
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
452
 
453
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
@@ -464,13 +530,13 @@ iterator points to the map element whose key is equivalent to `k`.
464
 
465
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
466
 
467
  ``` cpp
468
  template<class M>
469
- pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
470
  template<class M>
471
- iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
472
  ```
473
 
474
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
475
 
476
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
@@ -485,15 +551,43 @@ Otherwise inserts an object of type `value_type` constructed with
485
  pair is `true` if and only if the insertion took place. The returned
486
  iterator points to the map element whose key is equivalent to `k`.
487
 
488
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
489
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
  #### Erasure <a id="unord.map.erasure">[[unord.map.erasure]]</a>
491
 
492
  ``` cpp
493
  template<class K, class T, class H, class P, class A, class Predicate>
494
- typename unordered_map<K, T, H, P, A>::size_type
495
  erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred);
496
  ```
497
 
498
  *Effects:* Equivalent to:
499
 
 
18
 
19
  Subclause  [[unord.map]] only describes operations on `unordered_map`
20
  that are not described in one of the requirement tables, or for which
21
  there is additional semantic information.
22
 
23
+ The types `iterator` and `const_iterator` meet the constexpr iterator
24
+ requirements [[iterator.requirements.general]].
25
+
26
  ``` cpp
27
  namespace std {
28
  template<class Key,
29
  class T,
30
  class Hash = hash<Key>,
 
37
  using mapped_type = T;
38
  using value_type = pair<const Key, T>;
39
  using hasher = Hash;
40
  using key_equal = Pred;
41
  using allocator_type = Allocator;
42
+ using pointer = allocator_traits<Allocator>::pointer;
43
+ using const_pointer = allocator_traits<Allocator>::const_pointer;
44
  using reference = value_type&;
45
  using const_reference = const value_type&;
46
  using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
47
  using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
48
 
 
52
  using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
53
  using node_type = unspecified;
54
  using insert_return_type = insert-return-type<iterator, node_type>;
55
 
56
  // [unord.map.cnstr], construct/copy/destroy
57
+ constexpr unordered_map();
58
+ constexpr explicit unordered_map(size_type n, const hasher& hf = hasher(),
 
59
  const key_equal& eql = key_equal(),
60
  const allocator_type& a = allocator_type());
61
  template<class InputIterator>
62
+ constexpr unordered_map(InputIterator f, InputIterator l,
63
+ size_type n = see below, const hasher& hf = hasher(),
 
64
  const key_equal& eql = key_equal(),
65
  const allocator_type& a = allocator_type());
66
 
67
  template<container-compatible-range<value_type> R>
68
+ constexpr unordered_map(from_range_t, R&& rg, size_type n = see below,
69
  const hasher& hf = hasher(), const key_equal& eql = key_equal(),
70
  const allocator_type& a = allocator_type());
71
+ constexpr unordered_map(const unordered_map&);
72
+ constexpr unordered_map(unordered_map&&);
73
+ constexpr explicit unordered_map(const Allocator&);
74
+ constexpr unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
75
+ constexpr unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
76
+ constexpr unordered_map(initializer_list<value_type> il, size_type n = see below,
 
77
  const hasher& hf = hasher(),
78
  const key_equal& eql = key_equal(),
79
  const allocator_type& a = allocator_type());
80
+ constexpr unordered_map(size_type n, const allocator_type& a)
81
  : unordered_map(n, hasher(), key_equal(), a) { }
82
+ constexpr unordered_map(size_type n, const hasher& hf, const allocator_type& a)
83
  : unordered_map(n, hf, key_equal(), a) { }
84
  template<class InputIterator>
85
+ constexpr unordered_map(InputIterator f, InputIterator l, size_type n,
86
+ const allocator_type& a)
87
  : unordered_map(f, l, n, hasher(), key_equal(), a) { }
88
  template<class InputIterator>
89
+ constexpr unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
90
  const allocator_type& a)
91
  : unordered_map(f, l, n, hf, key_equal(), a) { }
92
  template<container-compatible-range<value_type> R>
93
+ constexpr unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
94
  : unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
95
  template<container-compatible-range<value_type> R>
96
+ constexpr unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf,
97
+ const allocator_type& a)
98
  : unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
99
+ constexpr unordered_map(initializer_list<value_type> il, size_type n,
100
+ const allocator_type& a)
101
  : unordered_map(il, n, hasher(), key_equal(), a) { }
102
+ constexpr unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
103
  const allocator_type& a)
104
  : unordered_map(il, n, hf, key_equal(), a) { }
105
+ constexpr ~unordered_map();
106
+ constexpr unordered_map& operator=(const unordered_map&);
107
+ constexpr unordered_map& operator=(unordered_map&&)
108
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
109
  is_nothrow_move_assignable_v<Hash> &&
110
  is_nothrow_move_assignable_v<Pred>);
111
+ constexpr unordered_map& operator=(initializer_list<value_type>);
112
+ constexpr allocator_type get_allocator() const noexcept;
113
 
114
  // iterators
115
+ constexpr iterator begin() noexcept;
116
+ constexpr const_iterator begin() const noexcept;
117
+ constexpr iterator end() noexcept;
118
+ constexpr const_iterator end() const noexcept;
119
+ constexpr const_iterator cbegin() const noexcept;
120
+ constexpr const_iterator cend() const noexcept;
121
 
122
  // capacity
123
+ constexpr bool empty() const noexcept;
124
+ constexpr size_type size() const noexcept;
125
+ constexpr size_type max_size() const noexcept;
126
 
127
  // [unord.map.modifiers], modifiers
128
+ template<class... Args> constexpr pair<iterator, bool> emplace(Args&&... args);
129
+ template<class... Args>
130
+ constexpr iterator emplace_hint(const_iterator position, Args&&... args);
131
+ constexpr pair<iterator, bool> insert(const value_type& obj);
132
+ constexpr pair<iterator, bool> insert(value_type&& obj);
133
+ template<class P> constexpr pair<iterator, bool> insert(P&& obj);
134
+ constexpr iterator insert(const_iterator hint, const value_type& obj);
135
+ constexpr iterator insert(const_iterator hint, value_type&& obj);
136
+ template<class P> constexpr iterator insert(const_iterator hint, P&& obj);
137
+ template<class InputIterator> constexpr void insert(InputIterator first, InputIterator last);
138
  template<container-compatible-range<value_type> R>
139
+ constexpr void insert_range(R&& rg);
140
+ constexpr void insert(initializer_list<value_type>);
141
 
142
+ constexpr node_type extract(const_iterator position);
143
+ constexpr node_type extract(const key_type& x);
144
+ template<class K> constexpr node_type extract(K&& x);
145
+ constexpr insert_return_type insert(node_type&& nh);
146
+ constexpr iterator insert(const_iterator hint, node_type&& nh);
147
 
148
  template<class... Args>
149
+ constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
150
  template<class... Args>
151
+ constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
152
+ template<class K, class... Args>
153
+ constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
154
  template<class... Args>
155
+ constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
156
  template<class... Args>
157
+ constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
158
+ template<class K, class... Args>
159
+ constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
160
  template<class M>
161
+ constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
162
  template<class M>
163
+ constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
164
+ template<class K, class M>
165
+ constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
166
  template<class M>
167
+ constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
168
  template<class M>
169
+ constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
170
+ template<class K, class M>
171
+ constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
172
 
173
+ constexpr iterator erase(iterator position);
174
+ constexpr iterator erase(const_iterator position);
175
+ constexpr size_type erase(const key_type& k);
176
+ template<class K> constexpr size_type erase(K&& x);
177
+ constexpr iterator erase(const_iterator first, const_iterator last);
178
+ constexpr void swap(unordered_map&)
179
  noexcept(allocator_traits<Allocator>::is_always_equal::value &&
180
+ is_nothrow_swappable_v<Hash> && is_nothrow_swappable_v<Pred>);
181
+ constexpr void clear() noexcept;
 
182
 
183
  template<class H2, class P2>
184
+ constexpr void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
185
  template<class H2, class P2>
186
+ constexpr void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
187
  template<class H2, class P2>
188
+ constexpr void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
189
  template<class H2, class P2>
190
+ constexpr void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
191
 
192
  // observers
193
+ constexpr hasher hash_function() const;
194
+ constexpr key_equal key_eq() const;
195
 
196
  // map operations
197
+ constexpr iterator find(const key_type& k);
198
+ constexpr const_iterator find(const key_type& k) const;
199
  template<class K>
200
+ constexpr iterator find(const K& k);
201
  template<class K>
202
+ constexpr const_iterator find(const K& k) const;
203
+ constexpr size_type count(const key_type& k) const;
204
  template<class K>
205
+ constexpr size_type count(const K& k) const;
206
+ constexpr bool contains(const key_type& k) const;
207
  template<class K>
208
+ constexpr bool contains(const K& k) const;
209
+ constexpr pair<iterator, iterator> equal_range(const key_type& k);
210
+ constexpr pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
211
  template<class K>
212
+ constexpr pair<iterator, iterator> equal_range(const K& k);
213
  template<class K>
214
+ constexpr pair<const_iterator, const_iterator> equal_range(const K& k) const;
215
 
216
  // [unord.map.elem], element access
217
+ constexpr mapped_type& operator[](const key_type& k);
218
+ constexpr mapped_type& operator[](key_type&& k);
219
+ template<class K> constexpr mapped_type& operator[](K&& k);
220
+ constexpr mapped_type& at(const key_type& k);
221
+ constexpr const mapped_type& at(const key_type& k) const;
222
+ template<class K> constexpr mapped_type& at(const K& k);
223
+ template<class K> constexpr const mapped_type& at(const K& k) const;
224
 
225
  // bucket interface
226
+ constexpr size_type bucket_count() const noexcept;
227
+ constexpr size_type max_bucket_count() const noexcept;
228
+ constexpr size_type bucket_size(size_type n) const;
229
+ constexpr size_type bucket(const key_type& k) const;
230
+ template<class K> constexpr size_type bucket(const K& k) const;
231
+ constexpr local_iterator begin(size_type n);
232
+ constexpr const_local_iterator begin(size_type n) const;
233
+ constexpr local_iterator end(size_type n);
234
+ constexpr const_local_iterator end(size_type n) const;
235
+ constexpr const_local_iterator cbegin(size_type n) const;
236
+ constexpr const_local_iterator cend(size_type n) const;
237
 
238
  // hash policy
239
+ constexpr float load_factor() const noexcept;
240
+ constexpr float max_load_factor() const noexcept;
241
+ constexpr void max_load_factor(float z);
242
+ constexpr void rehash(size_type n);
243
+ constexpr void reserve(size_type n);
244
  };
245
 
246
  template<class InputIterator,
247
  class Hash = hash<iter-key-type<InputIterator>>,
248
  class Pred = equal_to<iter-key-type<InputIterator>>,
 
319
  deduction guide.
320
 
321
  #### Constructors <a id="unord.map.cnstr">[[unord.map.cnstr]]</a>
322
 
323
  ``` cpp
324
+ constexpr unordered_map() : unordered_map(size_type(see below)) { }
325
+ constexpr explicit unordered_map(size_type n, const hasher& hf = hasher(),
 
326
  const key_equal& eql = key_equal(),
327
  const allocator_type& a = allocator_type());
328
  ```
329
 
330
  *Effects:* Constructs an empty `unordered_map` using the specified hash
 
334
 
335
  *Complexity:* Constant.
336
 
337
  ``` cpp
338
  template<class InputIterator>
339
+ constexpr unordered_map(InputIterator f, InputIterator l,
340
+ size_type n = see below, const hasher& hf = hasher(),
 
341
  const key_equal& eql = key_equal(),
342
  const allocator_type& a = allocator_type());
343
  template<container-compatible-range<value_type> R>
344
+ constexpr unordered_map(from_range_t, R&& rg,
345
+ size_type n = see below, const hasher& hf = hasher(),
 
346
  const key_equal& eql = key_equal(),
347
  const allocator_type& a = allocator_type());
348
+ constexpr unordered_map(initializer_list<value_type> il,
349
+ size_type n = see below, const hasher& hf = hasher(),
 
350
  const key_equal& eql = key_equal(),
351
  const allocator_type& a = allocator_type());
352
  ```
353
 
354
  *Effects:* Constructs an empty `unordered_map` using the specified hash
 
360
  *Complexity:* Average case linear, worst case quadratic.
361
 
362
  #### Element access <a id="unord.map.elem">[[unord.map.elem]]</a>
363
 
364
  ``` cpp
365
+ constexpr mapped_type& operator[](const key_type& k);
366
  ```
367
 
368
  *Effects:* Equivalent to: `return try_emplace(k).first->second;`
369
 
370
  ``` cpp
371
+ constexpr mapped_type& operator[](key_type&& k);
372
  ```
373
 
374
  *Effects:* Equivalent to:
375
  `return try_emplace(std::move(k)).first->second;`
376
 
377
  ``` cpp
378
+ template<class K> constexpr mapped_type& operator[](K&& k);
379
+ ```
380
+
381
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
382
+ `Pred::is_transparent` are valid and denote types.
383
+
384
+ *Effects:* Equivalent to:
385
+ `return try_emplace(std::forward<K>(k)).first->second;`
386
+
387
+ ``` cpp
388
+ constexpr mapped_type& at(const key_type& k);
389
+ constexpr const mapped_type& at(const key_type& k) const;
390
  ```
391
 
392
  *Returns:* A reference to `x.second`, where `x` is the (unique) element
393
  whose key is equivalent to `k`.
394
 
395
  *Throws:* An exception object of type `out_of_range` if no such element
396
  is present.
397
 
398
+ ``` cpp
399
+ template<class K> constexpr mapped_type& at(const K& k);
400
+ template<class K> constexpr const mapped_type& at(const K& k) const;
401
+ ```
402
+
403
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
404
+ `Pred::is_transparent` are valid and denote types.
405
+
406
+ *Preconditions:* The expression `find(k)` is well-formed and has
407
+ well-defined behavior.
408
+
409
+ *Returns:* A reference to `find(k)->second`.
410
+
411
+ *Throws:* An exception object of type `out_of_range` if
412
+ `find(k) == end()` is `true`.
413
+
414
  #### Modifiers <a id="unord.map.modifiers">[[unord.map.modifiers]]</a>
415
 
416
  ``` cpp
417
  template<class P>
418
+ constexpr pair<iterator, bool> insert(P&& obj);
419
  ```
420
 
421
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
422
 
423
  *Effects:* Equivalent to: `return emplace(std::forward<P>(obj));`
424
 
425
  ``` cpp
426
  template<class P>
427
+ constexpr iterator insert(const_iterator hint, P&& obj);
428
  ```
429
 
430
  *Constraints:* `is_constructible_v<value_type, P&&>` is `true`.
431
 
432
  *Effects:* Equivalent to:
433
  `return emplace_hint(hint, std::forward<P>(obj));`
434
 
435
  ``` cpp
436
  template<class... Args>
437
+ constexpr pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
438
  template<class... Args>
439
+ constexpr iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
440
  ```
441
 
442
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
443
  `unordered_map` from `piecewise_construct`, `forward_as_tuple(k)`,
444
  `forward_as_tuple(std::forward<Args>(args)...)`.
 
454
 
455
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
456
 
457
  ``` cpp
458
  template<class... Args>
459
+ constexpr pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
460
  template<class... Args>
461
+ constexpr iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
462
  ```
463
 
464
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
465
  `unordered_map` from `piecewise_construct`,
466
  `forward_as_tuple(std::move(k))`,
 
476
  pair is `true` if and only if the insertion took place. The returned
477
  iterator points to the map element whose key is equivalent to `k`.
478
 
479
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
480
 
481
+ ``` cpp
482
+ template<class K, class... Args>
483
+ constexpr pair<iterator, bool> try_emplace(K&& k, Args&&... args);
484
+ template<class K, class... Args>
485
+ constexpr iterator try_emplace(const_iterator hint, K&& k, Args&&... args);
486
+ ```
487
+
488
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
489
+ `Pred::is_transparent` are valid and denote types. For the first
490
+ overload, `is_convertible_v<K&&, const_iterator>` and
491
+ `is_convertible_v<K&&, iterator>` are both `false`.
492
+
493
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
494
+ `unordered_map` from
495
+ `piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args> (args)...)`.
496
+
497
+ *Effects:* If the map already contains an element whose key is
498
+ equivalent to `k`, there is no effect. Otherwise, let `h` be
499
+ `hash_function()(k)`. Constructs an object `u` of type `value_type` with
500
+ `piecewise_construct, forward_as_tuple(std::forward<K>(k)), forward_as_tuple(std::forward<Args>(args)...)`.
501
+ If `hash_function()(u.first) != h || contains(u.first)` is `true`, the
502
+ behavior is undefined. Inserts `u` into `*this`.
503
+
504
+ *Returns:* For the first overload, the `bool` component of the returned
505
+ pair is `true` if and only if the insertion took place. The returned
506
+ iterator points to the map element whose key is equivalent to `k`.
507
+
508
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
509
+
510
  ``` cpp
511
  template<class M>
512
+ constexpr pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
513
  template<class M>
514
+ constexpr iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
515
  ```
516
 
517
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
518
 
519
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
 
530
 
531
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
532
 
533
  ``` cpp
534
  template<class M>
535
+ constexpr pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
536
  template<class M>
537
+ constexpr iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
538
  ```
539
 
540
  *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
541
 
542
  *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
 
551
  pair is `true` if and only if the insertion took place. The returned
552
  iterator points to the map element whose key is equivalent to `k`.
553
 
554
  *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
555
 
556
+ ``` cpp
557
+ template<class K, class M>
558
+ constexpr pair<iterator, bool> insert_or_assign(K&& k, M&& obj);
559
+ template<class K, class M>
560
+ constexpr iterator insert_or_assign(const_iterator hint, K&& k, M&& obj);
561
+ ```
562
+
563
+ *Constraints:* The *qualified-id*s `Hash::is_transparent` and
564
+ `Pred::is_transparent` are valid and denote types.
565
+
566
+ *Mandates:* `is_assignable_v<mapped_type&, M&&>` is `true`.
567
+
568
+ *Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into
569
+ `unordered_map` from `std::forward<K> (k), std::forward<M>(obj)`.
570
+
571
+ *Effects:* If the map already contains an element `e` whose key is
572
+ equivalent to `k`, assigns `std::forward<M> (obj)` to `e.second`.
573
+ Otherwise, let `h` be `hash_function()(k)`. Constructs an object `u` of
574
+ type `value_type` with `std::forward<K>(k), std::forward<M>(obj)`. If
575
+ `hash_function()(u.first) != h || contains(u.first)` is `true`, the
576
+ behavior is undefined. Inserts `u` into `*this`.
577
+
578
+ *Returns:* For the first overload, the `bool` component of the returned
579
+ pair is `true` if and only if the insertion took place. The returned
580
+ iterator points to the map element whose key is equivalent to `k`.
581
+
582
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
583
+
584
  #### Erasure <a id="unord.map.erasure">[[unord.map.erasure]]</a>
585
 
586
  ``` cpp
587
  template<class K, class T, class H, class P, class A, class Predicate>
588
+ constexpr typename unordered_map<K, T, H, P, A>::size_type
589
  erase_if(unordered_map<K, T, H, P, A>& c, Predicate pred);
590
  ```
591
 
592
  *Effects:* Equivalent to:
593