From Jason Turner

[unord.map]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpawsqkqau/{from.md → to.md} +253 -69
tmp/tmpawsqkqau/{from.md → to.md} RENAMED
@@ -12,46 +12,47 @@ an unordered associative container, and of an allocator-aware container
12
  (Table  [[tab:containers.allocatoraware]]). It provides the operations
13
  described in the preceding requirements table for unique keys; that is,
14
  an `unordered_map` supports the `a_uniq` operations in that table, not
15
  the `a_eq` operations. For an `unordered_map<Key, T>` the `key type` is
16
  `Key`, the mapped type is `T`, and the value type is
17
- `std::pair<const Key, T>`.
18
 
19
  This section only describes operations on `unordered_map` that are not
20
  described in one of the requirement tables, or for which there is
21
  additional semantic information.
22
 
23
  ``` cpp
24
  namespace std {
25
  template <class Key,
26
  class T,
27
  class Hash = hash<Key>,
28
- class Pred = std::equal_to<Key>,
29
- class Allocator = std::allocator<std::pair<const Key, T> > >
30
- class unordered_map
31
- {
32
  public:
33
- // types
34
- typedef Key key_type;
35
- typedef std::pair<const Key, T> value_type;
36
- typedef T mapped_type;
37
- typedef Hash hasher;
38
- typedef Pred key_equal;
39
- typedef Allocator allocator_type;
40
- typedef typename allocator_traits<Allocator>::pointer pointer;
41
- typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
42
- typedef value_type& reference;
43
- typedef const value_type& const_reference;
44
- typedef implementation-defined size_type;
45
- typedef implementation-defined difference_type;
46
 
47
- typedef implementation-defined iterator;
48
- typedef implementation-defined const_iterator;
49
- typedef implementation-defined local_iterator;
50
- typedef implementation-defined const_local_iterator;
 
 
51
 
52
- // construct/destroy/copy
53
  unordered_map();
54
  explicit unordered_map(size_type n,
55
  const hasher& hf = hasher(),
56
  const key_equal& eql = key_equal(),
57
  const allocator_type& a = allocator_type());
@@ -64,12 +65,12 @@ namespace std {
64
  unordered_map(const unordered_map&);
65
  unordered_map(unordered_map&&);
66
  explicit unordered_map(const Allocator&);
67
  unordered_map(const unordered_map&, const Allocator&);
68
  unordered_map(unordered_map&&, const Allocator&);
69
- unordered_map(initializer_list<value_type>,
70
- size_type = see below,
71
  const hasher& hf = hasher(),
72
  const key_equal& eql = key_equal(),
73
  const allocator_type& a = allocator_type());
74
  unordered_map(size_type n, const allocator_type& a)
75
  : unordered_map(n, hasher(), key_equal(), a) { }
@@ -87,61 +88,101 @@ namespace std {
87
  unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
88
  const allocator_type& a)
89
  : unordered_map(il, n, hf, key_equal(), a) { }
90
  ~unordered_map();
91
  unordered_map& operator=(const unordered_map&);
92
- unordered_map& operator=(unordered_map&&);
 
 
 
93
  unordered_map& operator=(initializer_list<value_type>);
94
  allocator_type get_allocator() const noexcept;
95
 
96
- // size and capacity
97
- bool empty() const noexcept;
98
- size_type size() const noexcept;
99
- size_type max_size() const noexcept;
100
-
101
- // iterators
102
  iterator begin() noexcept;
103
  const_iterator begin() const noexcept;
104
  iterator end() noexcept;
105
  const_iterator end() const noexcept;
106
  const_iterator cbegin() const noexcept;
107
  const_iterator cend() const noexcept;
108
 
109
- // modifiers
 
 
 
 
 
110
  template <class... Args> pair<iterator, bool> emplace(Args&&... args);
111
  template <class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
112
  pair<iterator, bool> insert(const value_type& obj);
 
113
  template <class P> pair<iterator, bool> insert(P&& obj);
114
  iterator insert(const_iterator hint, const value_type& obj);
 
115
  template <class P> iterator insert(const_iterator hint, P&& obj);
116
  template <class InputIterator> void insert(InputIterator first, InputIterator last);
117
  void insert(initializer_list<value_type>);
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  iterator erase(const_iterator position);
120
  size_type erase(const key_type& k);
121
  iterator erase(const_iterator first, const_iterator last);
 
 
 
 
122
  void clear() noexcept;
123
 
124
- void swap(unordered_map&);
 
 
 
 
 
 
 
125
 
126
- // observers
127
  hasher hash_function() const;
128
  key_equal key_eq() const;
129
 
130
- // lookup
131
  iterator find(const key_type& k);
132
  const_iterator find(const key_type& k) const;
133
  size_type count(const key_type& k) const;
134
- std::pair<iterator, iterator> equal_range(const key_type& k);
135
- std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
136
 
 
137
  mapped_type& operator[](const key_type& k);
138
  mapped_type& operator[](key_type&& k);
139
  mapped_type& at(const key_type& k);
140
  const mapped_type& at(const key_type& k) const;
141
 
142
- // bucket interface
143
  size_type bucket_count() const noexcept;
144
  size_type max_bucket_count() const noexcept;
145
  size_type bucket_size(size_type n) const;
146
  size_type bucket(const key_type& k) const;
147
  local_iterator begin(size_type n);
@@ -149,31 +190,84 @@ namespace std {
149
  local_iterator end(size_type n);
150
  const_local_iterator end(size_type n) const;
151
  const_local_iterator cbegin(size_type n) const;
152
  const_local_iterator cend(size_type n) const;
153
 
154
- // hash policy
155
  float load_factor() const noexcept;
156
  float max_load_factor() const noexcept;
157
  void max_load_factor(float z);
158
  void rehash(size_type n);
159
  void reserve(size_type n);
160
  };
161
 
162
- template <class Key, class T, class Hash, class Pred, class Alloc>
163
- void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
164
- unordered_map<Key, T, Hash, Pred, Alloc>& y);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  template <class Key, class T, class Hash, class Pred, class Alloc>
167
  bool operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& a,
168
  const unordered_map<Key, T, Hash, Pred, Alloc>& b);
169
  template <class Key, class T, class Hash, class Pred, class Alloc>
170
  bool operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& a,
171
  const unordered_map<Key, T, Hash, Pred, Alloc>& b);
 
 
 
 
 
 
172
  }
173
  ```
174
 
 
 
 
 
175
  #### `unordered_map` constructors <a id="unord.map.cnstr">[[unord.map.cnstr]]</a>
176
 
177
  ``` cpp
178
  unordered_map() : unordered_map(size_type(see below)) { }
179
  explicit unordered_map(size_type n,
@@ -181,53 +275,52 @@ explicit unordered_map(size_type n,
181
  const key_equal& eql = key_equal(),
182
  const allocator_type& a = allocator_type());
183
  ```
184
 
185
  *Effects:* Constructs an empty `unordered_map` using the specified hash
186
- function, key equality function, and allocator, and using at least *`n`*
187
  buckets. For the default constructor, the number of buckets is
188
- *implementation-defined*. `max_load_factor()` returns 1.0.
189
 
190
  *Complexity:* Constant.
191
 
192
  ``` cpp
193
  template <class InputIterator>
194
  unordered_map(InputIterator f, InputIterator l,
195
  size_type n = see below,
196
  const hasher& hf = hasher(),
197
  const key_equal& eql = key_equal(),
198
  const allocator_type& a = allocator_type());
 
 
 
 
 
199
  ```
200
 
201
  *Effects:* Constructs an empty `unordered_map` using the specified hash
202
- function, key equality function, and allocator, and using at least *`n`*
203
- buckets. If *`n`* is not provided, the number of buckets is
204
- *implementation-defined*. Then inserts elements from the range
205
- `[`*`f`*`, `*`l`*`)`. `max_load_factor()` returns 1.0.
 
206
 
207
  *Complexity:* Average case linear, worst case quadratic.
208
 
209
  #### `unordered_map` element access <a id="unord.map.elem">[[unord.map.elem]]</a>
210
 
211
  ``` cpp
212
  mapped_type& operator[](const key_type& k);
 
 
 
 
 
213
  mapped_type& operator[](key_type&& k);
214
  ```
215
 
216
- *Requires:* `mapped_type` shall be `DefaultInsertable` into `*this`. For
217
- the first operator, `key_type` shall be `CopyInsertable` into `*this`.
218
- For the second operator, `key_type` shall be `MoveConstructible`.
219
-
220
- *Effects:* If the `unordered_map` does not already contain an element
221
- whose key is equivalent to *`k`*, the first operator inserts the value
222
- `value_type(k, mapped_type())` and the second operator inserts the value
223
- `value_type(std::move(k), mapped_type())`.
224
-
225
- *Returns:* A reference to `x.second`, where `x` is the (unique) element
226
- whose key is equivalent to *`k`*.
227
-
228
- *Complexity:* Average case 𝑂(1), worst case 𝑂(`size()`).
229
 
230
  ``` cpp
231
  mapped_type& at(const key_type& k);
232
  const mapped_type& at(const key_type& k) const;
233
  ```
@@ -243,31 +336,122 @@ is present.
243
  ``` cpp
244
  template <class P>
245
  pair<iterator, bool> insert(P&& obj);
246
  ```
247
 
248
- *Effects:* Equivalent to `return emplace(std::forward<P>(obj))`.
249
 
250
  *Remarks:* This signature shall not participate in overload resolution
251
- unless `std::is_constructible<value_type, P&&>::value` is `true`.
252
 
253
  ``` cpp
254
  template <class P>
255
  iterator insert(const_iterator hint, P&& obj);
256
  ```
257
 
258
- *Effects:* Equivalent to
259
- `return emplace_hint(hint, std::forward<P>(obj))`.
260
 
261
  *Remarks:* This signature shall not participate in overload resolution
262
- unless `std::is_constructible<value_type, P&&>::value` is `true`.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
 
264
  #### `unordered_map` swap <a id="unord.map.swap">[[unord.map.swap]]</a>
265
 
266
  ``` cpp
267
  template <class Key, class T, class Hash, class Pred, class Alloc>
268
  void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
269
- unordered_map<Key, T, Hash, Pred, Alloc>& y);
 
270
  ```
271
 
272
- *Effects:* `x.swap(y)`.
273
 
 
12
  (Table  [[tab:containers.allocatoraware]]). It provides the operations
13
  described in the preceding requirements table for unique keys; that is,
14
  an `unordered_map` supports the `a_uniq` operations in that table, not
15
  the `a_eq` operations. For an `unordered_map<Key, T>` the `key type` is
16
  `Key`, the mapped type is `T`, and the value type is
17
+ `pair<const Key, T>`.
18
 
19
  This section only describes operations on `unordered_map` that are not
20
  described in one of the requirement tables, or for which there is
21
  additional semantic information.
22
 
23
  ``` cpp
24
  namespace std {
25
  template <class Key,
26
  class T,
27
  class Hash = hash<Key>,
28
+ class Pred = equal_to<Key>,
29
+ class Allocator = allocator<pair<const Key, T>>>
30
+ class unordered_map {
 
31
  public:
32
+ // types:
33
+ using key_type = Key;
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; // see [container.requirements]
44
+ using difference_type = implementation-defined; // see [container.requirements]
45
 
46
+ using iterator = implementation-defined // type of unordered_map::iterator; // see [container.requirements]
47
+ using const_iterator = implementation-defined // type of unordered_map::const_iterator; // see [container.requirements]
48
+ using local_iterator = implementation-defined // type of unordered_map::local_iterator; // see [container.requirements]
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());
 
65
  unordered_map(const unordered_map&);
66
  unordered_map(unordered_map&&);
67
  explicit unordered_map(const Allocator&);
68
  unordered_map(const unordered_map&, const Allocator&);
69
  unordered_map(unordered_map&&, const Allocator&);
70
+ unordered_map(initializer_list<value_type> il,
71
+ size_type n = see below,
72
  const hasher& hf = hasher(),
73
  const key_equal& eql = key_equal(),
74
  const allocator_type& a = allocator_type());
75
  unordered_map(size_type n, const allocator_type& a)
76
  : unordered_map(n, hasher(), key_equal(), a) { }
 
88
  unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
89
  const allocator_type& a)
90
  : unordered_map(il, n, hf, key_equal(), a) { }
91
  ~unordered_map();
92
  unordered_map& operator=(const unordered_map&);
93
+ unordered_map& operator=(unordered_map&&)
94
+ noexcept(allocator_traits<Allocator>::is_always_equal::value &&
95
+ is_nothrow_move_assignable_v<Hash> &&
96
+ is_nothrow_move_assignable_v<Pred>);
97
  unordered_map& operator=(initializer_list<value_type>);
98
  allocator_type get_allocator() const noexcept;
99
 
100
+ // iterators:
 
 
 
 
 
101
  iterator begin() noexcept;
102
  const_iterator begin() const noexcept;
103
  iterator end() noexcept;
104
  const_iterator end() const noexcept;
105
  const_iterator cbegin() const noexcept;
106
  const_iterator cend() const noexcept;
107
 
108
+ // capacity:
109
+ bool empty() const noexcept;
110
+ size_type size() const noexcept;
111
+ size_type max_size() const noexcept;
112
+
113
+ // [unord.map.modifiers], modifiers
114
  template <class... Args> pair<iterator, bool> emplace(Args&&... args);
115
  template <class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
116
  pair<iterator, bool> insert(const value_type& obj);
117
+ pair<iterator, bool> insert(value_type&& obj);
118
  template <class P> pair<iterator, bool> insert(P&& obj);
119
  iterator insert(const_iterator hint, const value_type& obj);
120
+ iterator insert(const_iterator hint, value_type&& obj);
121
  template <class P> iterator insert(const_iterator hint, P&& obj);
122
  template <class InputIterator> void insert(InputIterator first, InputIterator last);
123
  void insert(initializer_list<value_type>);
124
 
125
+ node_type extract(const_iterator position);
126
+ node_type extract(const key_type& x);
127
+ insert_return_type insert(node_type&& nh);
128
+ iterator insert(const_iterator hint, node_type&& nh);
129
+
130
+ template <class... Args>
131
+ pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
132
+ template <class... Args>
133
+ pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
134
+ template <class... Args>
135
+ iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
136
+ template <class... Args>
137
+ iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
138
+ template <class M>
139
+ pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
140
+ template <class M>
141
+ pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
142
+ template <class M>
143
+ iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
144
+ template <class M>
145
+ iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
146
+
147
+ iterator erase(iterator position);
148
  iterator erase(const_iterator position);
149
  size_type erase(const key_type& k);
150
  iterator erase(const_iterator first, const_iterator last);
151
+ void swap(unordered_map&)
152
+ noexcept(allocator_traits<Allocator>::is_always_equal::value &&
153
+ is_nothrow_swappable_v<Hash> &&
154
+ is_nothrow_swappable_v<Pred>);
155
  void clear() noexcept;
156
 
157
+ template<class H2, class P2>
158
+ void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
159
+ template<class H2, class P2>
160
+ void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
161
+ template<class H2, class P2>
162
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>& source);
163
+ template<class H2, class P2>
164
+ void merge(unordered_multimap<Key, T, H2, P2, Allocator>&& source);
165
 
166
+ // observers:
167
  hasher hash_function() const;
168
  key_equal key_eq() const;
169
 
170
+ // map operations:
171
  iterator find(const key_type& k);
172
  const_iterator find(const key_type& k) const;
173
  size_type count(const key_type& k) const;
174
+ pair<iterator, iterator> equal_range(const key_type& k);
175
+ pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
176
 
177
+ // [unord.map.elem], element access
178
  mapped_type& operator[](const key_type& k);
179
  mapped_type& operator[](key_type&& k);
180
  mapped_type& at(const key_type& k);
181
  const mapped_type& at(const key_type& k) const;
182
 
183
+ // bucket interface:
184
  size_type bucket_count() const noexcept;
185
  size_type max_bucket_count() const noexcept;
186
  size_type bucket_size(size_type n) const;
187
  size_type bucket(const key_type& k) const;
188
  local_iterator begin(size_type n);
 
190
  local_iterator end(size_type n);
191
  const_local_iterator end(size_type n) const;
192
  const_local_iterator cbegin(size_type n) const;
193
  const_local_iterator cend(size_type n) const;
194
 
195
+ // hash policy:
196
  float load_factor() const noexcept;
197
  float max_load_factor() const noexcept;
198
  void max_load_factor(float z);
199
  void rehash(size_type n);
200
  void reserve(size_type n);
201
  };
202
 
203
+ template<class InputIterator,
204
+ class Hash = hash<iter_key_t<InputIterator>>,
205
+ class Pred = equal_to<iter_key_t<InputIterator>>,
206
+ class Allocator = allocator<iter_to_alloc_t<InputIterator>>>
207
+ unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
208
+ Hash = Hash(), Pred = Pred(), Allocator = Allocator())
209
+ -> unordered_map<iter_key_t<InputIterator>, iter_value_t<InputIterator>, Hash, Pred,
210
+ Allocator>;
211
+
212
+ template<class Key, class T, class Hash = hash<Key>,
213
+ class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
214
+ unordered_map(initializer_list<pair<const Key, T>>,
215
+ typename see below::size_type = see below, Hash = Hash(),
216
+ Pred = Pred(), Allocator = Allocator())
217
+ -> unordered_map<Key, T, Hash, Pred, Allocator>;
218
+
219
+ template<class InputIterator, class Allocator>
220
+ unordered_map(InputIterator, InputIterator, typename see below::size_type, Allocator)
221
+ -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
222
+ hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>,
223
+ Allocator>;
224
+
225
+ template<class InputIterator, class Allocator>
226
+ unordered_map(InputIterator, InputIterator, Allocator)
227
+ -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>,
228
+ hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>,
229
+ Allocator>;
230
+
231
+ template<class InputIterator, class Hash, class Allocator>
232
+ unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
233
+ -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash,
234
+ equal_to<iter_key_t<InputIterator>>, Allocator>;
235
+
236
+ template<class Key, class T, typename Allocator>
237
+ unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type,
238
+ Allocator)
239
+ -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
240
+
241
+ template<class Key, class T, typename Allocator>
242
+ unordered_map(initializer_list<pair<const Key, T>>, Allocator)
243
+ -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
244
+
245
+ template<class Key, class T, class Hash, class Allocator>
246
+ unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash,
247
+ Allocator)
248
+ -> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
249
 
250
  template <class Key, class T, class Hash, class Pred, class Alloc>
251
  bool operator==(const unordered_map<Key, T, Hash, Pred, Alloc>& a,
252
  const unordered_map<Key, T, Hash, Pred, Alloc>& b);
253
  template <class Key, class T, class Hash, class Pred, class Alloc>
254
  bool operator!=(const unordered_map<Key, T, Hash, Pred, Alloc>& a,
255
  const unordered_map<Key, T, Hash, Pred, Alloc>& b);
256
+
257
+ // [unord.map.swap], swap
258
+ template <class Key, class T, class Hash, class Pred, class Alloc>
259
+ void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
260
+ unordered_map<Key, T, Hash, Pred, Alloc>& y)
261
+ noexcept(noexcept(x.swap(y)));
262
  }
263
  ```
264
 
265
+ A `size_type` parameter type in an `unordered_map` deduction guide
266
+ refers to the `size_type` member type of the type deduced by the
267
+ deduction guide.
268
+
269
  #### `unordered_map` constructors <a id="unord.map.cnstr">[[unord.map.cnstr]]</a>
270
 
271
  ``` cpp
272
  unordered_map() : unordered_map(size_type(see below)) { }
273
  explicit unordered_map(size_type n,
 
275
  const key_equal& eql = key_equal(),
276
  const allocator_type& a = allocator_type());
277
  ```
278
 
279
  *Effects:* Constructs an empty `unordered_map` using the specified hash
280
+ function, key equality predicate, and allocator, and using at least `n`
281
  buckets. For the default constructor, the number of buckets is
282
+ *implementation-defined*. `max_load_factor()` returns `1.0`.
283
 
284
  *Complexity:* Constant.
285
 
286
  ``` cpp
287
  template <class InputIterator>
288
  unordered_map(InputIterator f, InputIterator l,
289
  size_type n = see below,
290
  const hasher& hf = hasher(),
291
  const key_equal& eql = key_equal(),
292
  const allocator_type& a = allocator_type());
293
+ unordered_map(initializer_list<value_type> il,
294
+ size_type n = see below,
295
+ const hasher& hf = hasher(),
296
+ const key_equal& eql = key_equal(),
297
+ const allocator_type& a = allocator_type());
298
  ```
299
 
300
  *Effects:* Constructs an empty `unordered_map` using the specified hash
301
+ function, key equality predicate, and allocator, and using at least `n`
302
+ buckets. If `n` is not provided, the number of buckets is
303
+ *implementation-defined*. Then inserts elements from the range \[`f`,
304
+ `l`) for the first form, or from the range \[`il.begin()`, `il.end()`)
305
+ for the second form. `max_load_factor()` returns `1.0`.
306
 
307
  *Complexity:* Average case linear, worst case quadratic.
308
 
309
  #### `unordered_map` element access <a id="unord.map.elem">[[unord.map.elem]]</a>
310
 
311
  ``` cpp
312
  mapped_type& operator[](const key_type& k);
313
+ ```
314
+
315
+ *Effects:* Equivalent to: `return try_emplace(k).first->second;`
316
+
317
+ ``` cpp
318
  mapped_type& operator[](key_type&& k);
319
  ```
320
 
321
+ *Effects:* Equivalent to: `return try_emplace(move(k)).first->second;`
 
 
 
 
 
 
 
 
 
 
 
 
322
 
323
  ``` cpp
324
  mapped_type& at(const key_type& k);
325
  const mapped_type& at(const key_type& k) const;
326
  ```
 
336
  ``` cpp
337
  template <class P>
338
  pair<iterator, bool> insert(P&& obj);
339
  ```
340
 
341
+ *Effects:* Equivalent to: `return emplace(std::forward<P>(obj));`
342
 
343
  *Remarks:* This signature shall not participate in overload resolution
344
+ unless `is_constructible_v<value_type, P&&>` is `true`.
345
 
346
  ``` cpp
347
  template <class P>
348
  iterator insert(const_iterator hint, P&& obj);
349
  ```
350
 
351
+ *Effects:* Equivalent to:
352
+ `return emplace_hint(hint, std::forward<P>(obj));`
353
 
354
  *Remarks:* This signature shall not participate in overload resolution
355
+ unless `is_constructible_v<value_type, P&&>` is `true`.
356
+
357
+ ``` cpp
358
+ template <class... Args>
359
+ pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
360
+ template <class... Args>
361
+ iterator try_emplace(const_iterator hint, const key_type& k, Args&&... args);
362
+ ```
363
+
364
+ *Requires:* `value_type` shall be `EmplaceConstructible` into
365
+ `unordered_map` from `piecewise_construct`, `forward_as_tuple(k)`,
366
+ `forward_as_tuple(std::forward<Args>(args)...)`.
367
+
368
+ *Effects:* If the map already contains an element whose key is
369
+ equivalent to `k`, there is no effect. Otherwise inserts an object of
370
+ type `value_type` constructed with `piecewise_construct`,
371
+ `forward_as_tuple(k)`, `forward_as_tuple(std::forward<Args>(args)...)`.
372
+
373
+ *Returns:* In the first overload, the `bool` component of the returned
374
+ pair is `true` if and only if the insertion took place. The returned
375
+ iterator points to the map element whose key is equivalent to `k`.
376
+
377
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
378
+
379
+ ``` cpp
380
+ template <class... Args>
381
+ pair<iterator, bool> try_emplace(key_type&& k, Args&&... args);
382
+ template <class... Args>
383
+ iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args);
384
+ ```
385
+
386
+ *Requires:* `value_type` shall be `EmplaceConstructible` into
387
+ `unordered_map` from `piecewise_construct`,
388
+ `forward_as_tuple(std::move(k))`,
389
+ `forward_as_tuple(std::forward<Args>(args)...)`.
390
+
391
+ *Effects:* If the map already contains an element whose key is
392
+ equivalent to `k`, there is no effect. Otherwise inserts an object of
393
+ type `value_type` constructed with `piecewise_construct`,
394
+ `forward_as_tuple(std::move(k))`,
395
+ `forward_as_tuple(std::forward<Args>(args)...)`.
396
+
397
+ *Returns:* In the first overload, the `bool` component of the returned
398
+ pair is `true` if and only if the insertion took place. The returned
399
+ iterator points to the map element whose key is equivalent to `k`.
400
+
401
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
402
+
403
+ ``` cpp
404
+ template <class M>
405
+ pair<iterator, bool> insert_or_assign(const key_type& k, M&& obj);
406
+ template <class M>
407
+ iterator insert_or_assign(const_iterator hint, const key_type& k, M&& obj);
408
+ ```
409
+
410
+ *Requires:* `is_assignable_v<mapped_type&, M&&>` shall be `true`.
411
+ `value_type` shall be `EmplaceConstructible` into `unordered_map` from
412
+ `k`, `std::forward<M>(obj)`.
413
+
414
+ *Effects:* If the map already contains an element `e` whose key is
415
+ equivalent to `k`, assigns `std::forward<M>(obj)` to `e.second`.
416
+ Otherwise inserts an object of type `value_type` constructed with `k`,
417
+ `std::forward<M>(obj)`.
418
+
419
+ *Returns:* In the first overload, the `bool` component of the returned
420
+ pair is `true` if and only if the insertion took place. The returned
421
+ iterator points to the map element whose key is equivalent to `k`.
422
+
423
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
424
+
425
+ ``` cpp
426
+ template <class M>
427
+ pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj);
428
+ template <class M>
429
+ iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
430
+ ```
431
+
432
+ *Requires:* `is_assignable_v<mapped_type&, M&&>` shall be `true`.
433
+ `value_type` shall be `EmplaceConstructible` into `unordered_map` from
434
+ `std::move(k)`, `std::forward<M>(obj)`.
435
+
436
+ *Effects:* If the map already contains an element `e` whose key is
437
+ equivalent to `k`, assigns `std::forward<M>(obj)` to `e.second`.
438
+ Otherwise inserts an object of type `value_type` constructed with
439
+ `std::move(k)`, `std::forward<M>(obj)`.
440
+
441
+ *Returns:* In the first overload, the `bool` component of the returned
442
+ pair is `true` if and only if the insertion took place. The returned
443
+ iterator points to the map element whose key is equivalent to `k`.
444
+
445
+ *Complexity:* The same as `emplace` and `emplace_hint`, respectively.
446
 
447
  #### `unordered_map` swap <a id="unord.map.swap">[[unord.map.swap]]</a>
448
 
449
  ``` cpp
450
  template <class Key, class T, class Hash, class Pred, class Alloc>
451
  void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
452
+ unordered_map<Key, T, Hash, Pred, Alloc>& y)
453
+ noexcept(noexcept(x.swap(y)));
454
  ```
455
 
456
+ *Effects:* As if by `x.swap(y)`.
457