From Jason Turner

[container.requirements]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwbvjh_nc/{from.md → to.md} +134 -65
tmp/tmpwbvjh_nc/{from.md → to.md} RENAMED
@@ -21,15 +21,16 @@ function and destroyed using the
21
  container’s element type, not for internal types used by the container.
22
  This means, for example, that a node-based container might need to
23
  construct nodes containing aligned buffers and call `construct` to place
24
  the element into the buffer.
25
 
26
- In Tables  [[tab:containers.container.requirements]] and
27
- [[tab:containers.reversible.requirements]], `X` denotes a container
28
- class containing objects of type `T`, `a` and `b` denote values of type
29
- `X`, `u` denotes an identifier, `r` denotes a non-const value of type
30
- `X`, and `rv` denotes a non-const rvalue of type `X`.
 
31
 
32
  Notes: the algorithm `equal()` is defined in Clause  [[algorithms]].
33
  Those entries marked “(Note A)” or “(Note B)” have linear complexity for
34
  `array` and have constant complexity for all other standard containers.
35
 
@@ -41,28 +42,44 @@ constructors, inserts, and erases.
41
 
42
  returns an iterator referring to the first element in the container.
43
  `end()` returns an iterator which is the past-the-end value for the
44
  container. If the container is empty, then `begin() == end()`;
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  Unless otherwise specified, all containers defined in this clause obtain
47
  memory using an allocator (see  [[allocator.requirements]]). Copy
48
  constructors for these container types obtain an allocator by calling
49
  `allocator_traits<allocator_type>::select_on_container_copy_construction`
50
- on their first parameters. Move constructors obtain an allocator by move
51
- construction from the allocator belonging to the container being moved.
52
- Such move construction of the allocator shall not exit via an exception.
53
- All other constructors for these container types take an `Allocator&`
54
- argument ([[allocator.requirements]]), an allocator whose value type is
55
- the same as the container’s value type. If an invocation of a
56
- constructor uses the default value of an optional allocator argument,
57
- then the `Allocator` type must support value initialization. A copy of
58
- this allocator is used for any memory allocation performed, by these
59
- constructors and by all member functions, during the lifetime of each
60
- container object or until the allocator is replaced. The allocator may
61
- be replaced only via assignment or `swap()`. Allocator replacement is
62
- performed by copy assignment, move assignment, or swapping of the
63
- allocator only if
64
  `allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value`,
65
  `allocator_traits<allocator_type>::propagate_on_container_move_assignment::value`,
66
  or
67
  `allocator_traits<allocator_type>::propagate_on_container_swap::value`
68
  is true within the implementation of the corresponding container
@@ -101,12 +118,13 @@ Unless otherwise specified (see  [[associative.reqmts.except]],
101
  container types defined in this Clause meet the following additional
102
  requirements:
103
 
104
  - if an exception is thrown by an `insert()` or `emplace()` function
105
  while inserting a single element, that function has no effects.
106
- - if an exception is thrown by a `push_back()` or `push_front()`
107
- function, that function has no effects.
 
108
  - no `erase()`, `clear()`, `pop_back()` or `pop_front()` function throws
109
  an exception.
110
  - no copy constructor or assignment operator of a returned iterator
111
  throws an exception.
112
  - no `swap()` function throws an exception.
@@ -134,29 +152,56 @@ All of the containers defined in this Clause and in ([[basic.string]])
134
  except `array` meet the additional requirements of an allocator-aware
135
  container, as described in Table  [[tab:containers.allocatoraware]].
136
 
137
  Given a container type `X` having an `allocator_type` identical to `A`
138
  and a `value_type` identical to `T` and given an lvalue `m` of type `A`,
139
- a pointer `p` of type `T*`, an expression `v` of type `T`, and an rvalue
140
- `rv` of type `T`, the following terms are defined. (If `X` is not
141
- allocator-aware, the terms below are defined as if `A` were
142
- `std::allocator<T>`.)
 
143
 
144
- - `T` is *`CopyInsertable` into `X`* means that the following expression
145
- is well-formed:
146
  ``` cpp
147
- allocator_traits<A>::construct(m, p, v);
148
  ```
 
 
 
 
 
 
 
 
149
  - `T` is *`MoveInsertable` into `X`* means that the following expression
150
  is well-formed:
151
  ``` cpp
152
- allocator_traits<A>::construct(m, p, rv);
153
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  - `T` is *`EmplaceConstructible` into `X` from `args`*, for zero or more
155
  arguments `args`, means that the following expression is well-formed:
156
  ``` cpp
157
- allocator_traits<A>::construct(m, p, args);
 
 
 
 
 
158
  ```
159
 
160
  A container calls `allocator_traits<A>::construct(m, p, args)` to
161
  construct an element at `p` using `args`. The default `construct` in
162
  `std::allocator` will call `::new((void*)p) T(args)`, but specialized
@@ -164,12 +209,12 @@ allocators may choose a different definition.
164
 
165
  In Table  [[tab:containers.allocatoraware]], `X` denotes an
166
  allocator-aware container class with a `value_type` of `T` using
167
  allocator of type `A`, `u` denotes a variable, `a` and `b` denote
168
  non-const lvalues of type `X`, `t` denotes an lvalue or a const rvalue
169
- of type X``, `rv` denotes a non-const rvalue of type `X`, `m` is a value
170
- of type `A`, and `Q` is an allocator type.
171
 
172
  ### Container data races <a id="container.requirements.dataraces">[[container.requirements.dataraces]]</a>
173
 
174
  For purposes of avoiding data races ([[res.on.data.races]]),
175
  implementations shall consider the following functions to be `const`:
@@ -177,11 +222,11 @@ implementations shall consider the following functions to be `const`:
177
  `lower_bound`, `upper_bound`, `equal_range`, `at` and, except in
178
  associative or unordered associative containers, `operator[]`.
179
 
180
  Notwithstanding ([[res.on.data.races]]), implementations are required
181
  to avoid data races when the contents of the contained object in
182
- different elements in the same sequence, excepting `vector<bool>`, are
183
  modified concurrently.
184
 
185
  For a `vector<int> x` with a size greater than one, `x[1] = 5` and
186
  `*x.begin() = 10` can be executed concurrently without a data race, but
187
  `x[0] = 5` and `*x.begin() = 10` executed concurrently may result in a
@@ -240,12 +285,12 @@ The iterator returned from `a.insert(p, n, t)` points to the copy of the
240
  first element inserted into `a`, or `p` if `n == 0`.
241
 
242
  The iterator returned from `a.insert(p, i, j)` points to the copy of the
243
  first element inserted into `a`, or `p` if `i == j`.
244
 
245
- The iterator returned from `a.insert(p, i1)` points to the copy of the
246
- first element inserted into `a`, or `p` if `i1` is empty.
247
 
248
  The iterator returned from `a.emplace(p, args)` points to the new
249
  element constructed from `args` into `a`.
250
 
251
  The iterator returned from `a.erase(q)` points to the element
@@ -305,12 +350,12 @@ library provides four basic kinds of associative containers: `set`,
305
  `multiset`, `map` and `multimap`.
306
 
307
  Each associative container is parameterized on `Key` and an ordering
308
  relation `Compare` that induces a strict weak ordering (
309
  [[alg.sorting]]) on elements of `Key`. In addition, `map` and `multimap`
310
- associate an arbitrary type `T` with the `Key`. The object of type
311
- `Compare` is called the *comparison object* of a container.
312
 
313
  The phrase “equivalence of keys” means the equivalence relation imposed
314
  by the comparison and *not* the `operator==` on keys. That is, two keys
315
  `k1` and `k2` are considered to be equivalent if for the comparison
316
  object `comp`, `comp(k1, k2) == false && comp(k2, k1) == false`. For any
@@ -323,12 +368,11 @@ The `set` and `map` classes support unique keys; the `multiset` and
323
  `multimap` classes support equivalent keys. For `multiset` and
324
  `multimap`, `insert`, `emplace`, and `erase` preserve the relative
325
  ordering of equivalent elements.
326
 
327
  For `set` and `multiset` the value type is the same as the key type. For
328
- `map` and `multimap` it is equal to `pair<const Key, T>`. Keys in an
329
- associative container are immutable.
330
 
331
  `iterator`
332
 
333
  of an associative container is of the bidirectional iterator category.
334
  For associative containers where the value type is the same as the key
@@ -349,24 +393,31 @@ associated `value_type`, `pair<const key_type, mapped_type>`, is not
349
  `CopyAssignable`.
350
 
351
  In Table  [[tab:containers.associative.requirements]], `X` denotes an
352
  associative container class, `a` denotes a value of `X`, `a_uniq`
353
  denotes a value of `X` when `X` supports unique keys, `a_eq` denotes a
354
- value of `X` when `X` supports multiple keys, `u` denotes an identifier,
355
- `i` and `j` satisfy input iterator requirements and refer to elements
356
- implicitly convertible to `value_type`, \[`i`, `j`) denotes a valid
357
- range, `p` denotes a valid const iterator to `a`, `q` denotes a valid
358
- dereferenceable const iterator to `a`, `[q1, q2)` denotes a valid range
359
- of const iterators in `a`, `il` designates an object of type
360
- `initializer_list<value_type>`, `t` denotes a value of `X::value_type`,
361
- `k` denotes a value of `X::key_type` and `c` denotes a value of type
362
- `X::key_compare`. `A` denotes the storage allocator used by `X`, if any,
363
- or `std::allocator<X::value_type>` otherwise, and `m` denotes an
364
- allocator of a type convertible to `A`.
 
 
 
 
 
 
 
365
 
366
  The `insert` and `emplace` members shall not affect the validity of
367
- iterators and references to the container, and the erase members shall
368
  invalidate only iterators and references to the erased elements.
369
 
370
  The fundamental property of iterators of associative containers is that
371
  they iterate through the containers in the non-descending order of keys
372
  where non-descending is defined by the comparison that was used to
@@ -390,10 +441,15 @@ passed object, even if that object is passed by reference. When an
390
  associative container is copied, either through a copy constructor or an
391
  assignment operator, the target container shall then use the comparison
392
  object from the container being copied, as if that comparison object had
393
  been passed to the target container in its constructor.
394
 
 
 
 
 
 
395
  #### Exception safety guarantees <a id="associative.reqmts.except">[[associative.reqmts.except]]</a>
396
 
397
  For associative containers, no `clear()` function throws an exception.
398
  `erase(k)` does not throw an exception unless that exception is thrown
399
  by the container’s `Compare` object (if any).
@@ -425,19 +481,24 @@ function object type `Hash` that meets the `Hash` requirements (
425
  of type `Key`, and by a binary predicate `Pred` that induces an
426
  equivalence relation on values of type `Key`. Additionally,
427
  `unordered_map` and `unordered_multimap` associate an arbitrary *mapped
428
  type* `T` with the `Key`.
429
 
430
- A hash function is a function object that takes a single argument of
431
- type `Key` and returns a value of type `std::size_t`.
 
 
432
 
433
  Two values `k1` and `k2` of type `Key` are considered equivalent if the
434
- container’s `key_equal` function object returns `true` when passed those
435
- values. If `k1` and `k2` are equivalent, the hash function shall return
436
- the same value for both. Thus, when an unordered associative container
437
- is instantiated with a non-default `Pred` parameter it usually needs a
438
- non-default `Hash` parameter as well.
 
 
 
439
 
440
  An unordered associative container supports *unique keys* if it may
441
  contain at most one element for each key. Otherwise, it supports
442
  *equivalent keys*. `unordered_set` and `unordered_map` support unique
443
  keys. `unordered_multiset` and `unordered_multimap` support equivalent
@@ -453,10 +514,18 @@ unless otherwise specified.
453
  For `unordered_set` and `unordered_multiset` the value type is the same
454
  as the key type. For `unordered_map` and `unordered_multimap` it is
455
  `std::pair<const Key,
456
  T>`.
457
 
 
 
 
 
 
 
 
 
458
  The elements of an unordered associative container are organized into
459
  *buckets*. Keys with the same hash code appear in the same bucket. The
460
  number of buckets is automatically increased as elements are added to an
461
  unordered associative container, so that the average number of elements
462
  per bucket is kept below a bound. Rehashing invalidates iterators,
@@ -491,15 +560,14 @@ type `float`.
491
 
492
  Two unordered containers `a` and `b` compare equal if
493
  `a.size() == b.size()` and, for every equivalent-key group \[`Ea1`,
494
  `Ea2`) obtained from `a.equal_range(Ea1)`, there exists an
495
  equivalent-key group \[`Eb1`, `Eb2`) obtained from `b.equal_range(Ea1)`,
496
- such that `distance(Ea1, Ea2) == distance(Eb1, Eb2)` and
497
- `is_permutation(Ea1, Ea2, Eb1)` returns `true`. For `unordered_set` and
498
- `unordered_map`, the complexity of `operator==` (i.e., the number of
499
- calls to the `==` operator of the `value_type`, to the predicate
500
- returned by `key_equal()`, and to the hasher returned by
501
  `hash_function()`) is proportional to N in the average case and to N² in
502
  the worst case, where N is a.size(). For `unordered_multiset` and
503
  `unordered_multimap`, the complexity of `operator==` is proportional to
504
  $\sum E_i^2$ in the average case and to N² in the worst case, where N is
505
  `a.size()`, and Eᵢ is the size of the iᵗʰ equivalent-key group in `a`.
@@ -521,12 +589,13 @@ associative container are of at least the forward iterator category. For
521
  unordered associative containers where the key type and value type are
522
  the same, both `iterator` and `const_iterator` are const iterators.
523
 
524
  The `insert` and `emplace` members shall not affect the validity of
525
  references to container elements, but may invalidate all iterators to
526
- the container. The erase members shall invalidate only iterators and
527
- references to the erased elements.
 
528
 
529
  The `insert` and `emplace` members shall not affect the validity of
530
  iterators if `(N+n) < z * B`, where `N` is the number of elements in the
531
  container prior to the insert operation, `n` is the number of elements
532
  inserted, `B` is the container’s bucket count, and `z` is the
 
21
  container’s element type, not for internal types used by the container.
22
  This means, for example, that a node-based container might need to
23
  construct nodes containing aligned buffers and call `construct` to place
24
  the element into the buffer.
25
 
26
+ In Tables  [[tab:containers.container.requirements]],
27
+ [[tab:containers.reversible.requirements]], and
28
+ [[tab:containers.optional.operations]] `X` denotes a container class
29
+ containing objects of type `T`, `a` and `b` denote values of type `X`,
30
+ `u` denotes an identifier, `r` denotes a non-const value of type `X`,
31
+ and `rv` denotes a non-const rvalue of type `X`.
32
 
33
  Notes: the algorithm `equal()` is defined in Clause  [[algorithms]].
34
  Those entries marked “(Note A)” or “(Note B)” have linear complexity for
35
  `array` and have constant complexity for all other standard containers.
36
 
 
42
 
43
  returns an iterator referring to the first element in the container.
44
  `end()` returns an iterator which is the past-the-end value for the
45
  container. If the container is empty, then `begin() == end()`;
46
 
47
+ In the expressions
48
+
49
+ ``` cpp
50
+ i == j
51
+ i != j
52
+ i < j
53
+ i <= j
54
+ i >= j
55
+ i > j
56
+ i - j
57
+ ```
58
+
59
+ where `i` and `j` denote objects of a container’s `iterator` type,
60
+ either or both may be replaced by an object of the container’s
61
+ `const_iterator` type referring to the same element with no change in
62
+ semantics.
63
+
64
  Unless otherwise specified, all containers defined in this clause obtain
65
  memory using an allocator (see  [[allocator.requirements]]). Copy
66
  constructors for these container types obtain an allocator by calling
67
  `allocator_traits<allocator_type>::select_on_container_copy_construction`
68
+ on the allocator belonging to the container being copied. Move
69
+ constructors obtain an allocator by move construction from the allocator
70
+ belonging to the container being moved. Such move construction of the
71
+ allocator shall not exit via an exception. All other constructors for
72
+ these container types take a `const allocator_type&` argument. If an
73
+ invocation of a constructor uses the default value of an optional
74
+ allocator argument, then the `Allocator` type must support value
75
+ initialization. A copy of this allocator is used for any memory
76
+ allocation performed, by these constructors and by all member functions,
77
+ during the lifetime of each container object or until the allocator is
78
+ replaced. The allocator may be replaced only via assignment or `swap()`.
79
+ Allocator replacement is performed by copy assignment, move assignment,
80
+ or swapping of the allocator only if
 
81
  `allocator_traits<allocator_type>::propagate_on_container_copy_assignment::value`,
82
  `allocator_traits<allocator_type>::propagate_on_container_move_assignment::value`,
83
  or
84
  `allocator_traits<allocator_type>::propagate_on_container_swap::value`
85
  is true within the implementation of the corresponding container
 
118
  container types defined in this Clause meet the following additional
119
  requirements:
120
 
121
  - if an exception is thrown by an `insert()` or `emplace()` function
122
  while inserting a single element, that function has no effects.
123
+ - if an exception is thrown by a `push_back()`, `push_front()`,
124
+ `emplace_back()`, or `emplace_front()` function, that function has no
125
+ effects.
126
  - no `erase()`, `clear()`, `pop_back()` or `pop_front()` function throws
127
  an exception.
128
  - no copy constructor or assignment operator of a returned iterator
129
  throws an exception.
130
  - no `swap()` function throws an exception.
 
152
  except `array` meet the additional requirements of an allocator-aware
153
  container, as described in Table  [[tab:containers.allocatoraware]].
154
 
155
  Given a container type `X` having an `allocator_type` identical to `A`
156
  and a `value_type` identical to `T` and given an lvalue `m` of type `A`,
157
+ a pointer `p` of type `T*`, an expression `v` of type (possibly const)
158
+ `T`, and an rvalue `rv` of type `T`, the following terms are defined. If
159
+ `X` is not allocator-aware, the terms below are defined as if `A` were
160
+ `std::allocator<T>` — no allocator object needs to be created and user
161
+ specializations of `std::allocator<T>` are not instantiated:
162
 
163
+ - `T` is *`DefaultInsertable` into `X`* means that the following
164
+ expression is well-formed:
165
  ``` cpp
166
+ allocator_traits<A>::construct(m, p)
167
  ```
168
+ - An element of `X` is *default-inserted* if it is initialized by
169
+ evaluation of the expression
170
+ ``` cpp
171
+ allocator_traits<A>::construct(m, p)
172
+ ```
173
+
174
+ where `p` is the address of the uninitialized storage for the element
175
+ allocated within `X`.
176
  - `T` is *`MoveInsertable` into `X`* means that the following expression
177
  is well-formed:
178
  ``` cpp
179
+ allocator_traits<A>::construct(m, p, rv)
180
  ```
181
+
182
+ and its evaluation causes the following postcondition to hold: The
183
+ value of `*p` is equivalent to the value of `rv` before the
184
+ evaluation. rv remains a valid object. Its state is unspecified
185
+ - `T` is *`CopyInsertable` into `X`* means that, in addition to `T`
186
+ being `MoveInsertable` into `X`, the following expression is
187
+ well-formed:
188
+ ``` cpp
189
+ allocator_traits<A>::construct(m, p, v)
190
+ ```
191
+
192
+ and its evaluation causes the following postcondition to hold: The
193
+ value of `v` is unchanged and is equivalent to `*p`.
194
  - `T` is *`EmplaceConstructible` into `X` from `args`*, for zero or more
195
  arguments `args`, means that the following expression is well-formed:
196
  ``` cpp
197
+ allocator_traits<A>::construct(m, p, args)
198
+ ```
199
+ - `T` is *`Erasable` from `X`* means that the following expression is
200
+ well-formed:
201
+ ``` cpp
202
+ allocator_traits<A>::destroy(m, p)
203
  ```
204
 
205
  A container calls `allocator_traits<A>::construct(m, p, args)` to
206
  construct an element at `p` using `args`. The default `construct` in
207
  `std::allocator` will call `::new((void*)p) T(args)`, but specialized
 
209
 
210
  In Table  [[tab:containers.allocatoraware]], `X` denotes an
211
  allocator-aware container class with a `value_type` of `T` using
212
  allocator of type `A`, `u` denotes a variable, `a` and `b` denote
213
  non-const lvalues of type `X`, `t` denotes an lvalue or a const rvalue
214
+ of type `X`, `rv` denotes a non-const rvalue of type `X`, and `m` is a
215
+ value of type `A`.
216
 
217
  ### Container data races <a id="container.requirements.dataraces">[[container.requirements.dataraces]]</a>
218
 
219
  For purposes of avoiding data races ([[res.on.data.races]]),
220
  implementations shall consider the following functions to be `const`:
 
222
  `lower_bound`, `upper_bound`, `equal_range`, `at` and, except in
223
  associative or unordered associative containers, `operator[]`.
224
 
225
  Notwithstanding ([[res.on.data.races]]), implementations are required
226
  to avoid data races when the contents of the contained object in
227
+ different elements in the same container, excepting `vector<bool>`, are
228
  modified concurrently.
229
 
230
  For a `vector<int> x` with a size greater than one, `x[1] = 5` and
231
  `*x.begin() = 10` can be executed concurrently without a data race, but
232
  `x[0] = 5` and `*x.begin() = 10` executed concurrently may result in a
 
285
  first element inserted into `a`, or `p` if `n == 0`.
286
 
287
  The iterator returned from `a.insert(p, i, j)` points to the copy of the
288
  first element inserted into `a`, or `p` if `i == j`.
289
 
290
+ The iterator returned from `a.insert(p, il)` points to the copy of the
291
+ first element inserted into `a`, or `p` if `il` is empty.
292
 
293
  The iterator returned from `a.emplace(p, args)` points to the new
294
  element constructed from `args` into `a`.
295
 
296
  The iterator returned from `a.erase(q)` points to the element
 
350
  `multiset`, `map` and `multimap`.
351
 
352
  Each associative container is parameterized on `Key` and an ordering
353
  relation `Compare` that induces a strict weak ordering (
354
  [[alg.sorting]]) on elements of `Key`. In addition, `map` and `multimap`
355
+ associate an arbitrary *mapped type* `T` with the `Key`. The object of
356
+ type `Compare` is called the *comparison object* of a container.
357
 
358
  The phrase “equivalence of keys” means the equivalence relation imposed
359
  by the comparison and *not* the `operator==` on keys. That is, two keys
360
  `k1` and `k2` are considered to be equivalent if for the comparison
361
  object `comp`, `comp(k1, k2) == false && comp(k2, k1) == false`. For any
 
368
  `multimap` classes support equivalent keys. For `multiset` and
369
  `multimap`, `insert`, `emplace`, and `erase` preserve the relative
370
  ordering of equivalent elements.
371
 
372
  For `set` and `multiset` the value type is the same as the key type. For
373
+ `map` and `multimap` it is equal to `pair<const Key, T>`.
 
374
 
375
  `iterator`
376
 
377
  of an associative container is of the bidirectional iterator category.
378
  For associative containers where the value type is the same as the key
 
393
  `CopyAssignable`.
394
 
395
  In Table  [[tab:containers.associative.requirements]], `X` denotes an
396
  associative container class, `a` denotes a value of `X`, `a_uniq`
397
  denotes a value of `X` when `X` supports unique keys, `a_eq` denotes a
398
+ value of `X` when `X` supports multiple keys, `a_tran` denotes a value
399
+ of `X` when the qualified-id `X::key_compare::is_transparent` is valid
400
+ and denotes a type ([[temp.deduct]]), `i` and `j` satisfy input
401
+ iterator requirements and refer to elements implicitly convertible to
402
+ `value_type`, \[`i`, `j`) denotes a valid range, `p` denotes a valid
403
+ const iterator to `a`, `q` denotes a valid dereferenceable const
404
+ iterator to `a`, `[q1, q2)` denotes a valid range of const iterators in
405
+ `a`, `il` designates an object of type `initializer_list<value_type>`,
406
+ `t` denotes a value of `X::value_type`, `k` denotes a value of
407
+ `X::key_type` and `c` denotes a value of type `X::key_compare`; `kl` is
408
+ a value such that `a` is partitioned ([[alg.sorting]]) with respect to
409
+ `c(r, kl)`, with `r` the key value of `e` and `e` in `a`; `ku` is a
410
+ value such that `a` is partitioned with respect to `!c(ku, r)`; `ke` is
411
+ a value such that `a` is partitioned with respect to `c(r, ke)` and
412
+ `!c(ke, r)`, with `c(r, ke)` implying `!c(ke, r)`. `A` denotes the
413
+ storage allocator used by `X`, if any, or
414
+ `std::allocator<X::value_type>` otherwise, and `m` denotes an allocator
415
+ of a type convertible to `A`.
416
 
417
  The `insert` and `emplace` members shall not affect the validity of
418
+ iterators and references to the container, and the `erase` members shall
419
  invalidate only iterators and references to the erased elements.
420
 
421
  The fundamental property of iterators of associative containers is that
422
  they iterate through the containers in the non-descending order of keys
423
  where non-descending is defined by the comparison that was used to
 
441
  associative container is copied, either through a copy constructor or an
442
  assignment operator, the target container shall then use the comparison
443
  object from the container being copied, as if that comparison object had
444
  been passed to the target container in its constructor.
445
 
446
+ The member function templates `find`, `count`, `lower_bound`,
447
+ `upper_bound`, and `equal_range` shall not participate in overload
448
+ resolution unless the qualified-id `Compare::is_transparent` is valid
449
+ and denotes a type ([[temp.deduct]]).
450
+
451
  #### Exception safety guarantees <a id="associative.reqmts.except">[[associative.reqmts.except]]</a>
452
 
453
  For associative containers, no `clear()` function throws an exception.
454
  `erase(k)` does not throw an exception unless that exception is thrown
455
  by the container’s `Compare` object (if any).
 
481
  of type `Key`, and by a binary predicate `Pred` that induces an
482
  equivalence relation on values of type `Key`. Additionally,
483
  `unordered_map` and `unordered_multimap` associate an arbitrary *mapped
484
  type* `T` with the `Key`.
485
 
486
+ The container’s object of type `Hash` denoted by `hash` is called
487
+ the *hash function* of the container. The container’s object of type
488
+ `Pred` — denoted by `pred` — is called the *key equality predicate* of
489
+ the container.
490
 
491
  Two values `k1` and `k2` of type `Key` are considered equivalent if the
492
+ container’s key equality predicate returns `true` when passed those
493
+ values. If `k1` and `k2` are equivalent, the container’s hash function
494
+ shall return the same value for both. Thus, when an unordered
495
+ associative container is instantiated with a non-default `Pred`
496
+ parameter it usually needs a non-default `Hash` parameter as well. For
497
+ any two keys `k1` and `k2` in the same container, calling `pred(k1, k2)`
498
+ shall always return the same value. For any key `k` in a container,
499
+ calling `hash(k)` shall always return the same value.
500
 
501
  An unordered associative container supports *unique keys* if it may
502
  contain at most one element for each key. Otherwise, it supports
503
  *equivalent keys*. `unordered_set` and `unordered_map` support unique
504
  keys. `unordered_multiset` and `unordered_multimap` support equivalent
 
514
  For `unordered_set` and `unordered_multiset` the value type is the same
515
  as the key type. For `unordered_map` and `unordered_multimap` it is
516
  `std::pair<const Key,
517
  T>`.
518
 
519
+ For unordered containers where the value type is the same as the key
520
+ type, both `iterator` and `const_iterator` are constant iterators. It is
521
+ unspecified whether or not `iterator` and `const_iterator` are the same
522
+ type. `iterator` and `const_iterator` have identical semantics in this
523
+ case, and `iterator` is convertible to `const_iterator`. Users can avoid
524
+ violating the One Definition Rule by always using `const_iterator` in
525
+ their function parameter lists.
526
+
527
  The elements of an unordered associative container are organized into
528
  *buckets*. Keys with the same hash code appear in the same bucket. The
529
  number of buckets is automatically increased as elements are added to an
530
  unordered associative container, so that the average number of elements
531
  per bucket is kept below a bound. Rehashing invalidates iterators,
 
560
 
561
  Two unordered containers `a` and `b` compare equal if
562
  `a.size() == b.size()` and, for every equivalent-key group \[`Ea1`,
563
  `Ea2`) obtained from `a.equal_range(Ea1)`, there exists an
564
  equivalent-key group \[`Eb1`, `Eb2`) obtained from `b.equal_range(Ea1)`,
565
+ such that `is_permutation(Ea1, Ea2, Eb1, Eb2)` returns `true`. For
566
+ `unordered_set` and `unordered_map`, the complexity of `operator==`
567
+ (i.e., the number of calls to the `==` operator of the `value_type`, to
568
+ the predicate returned by `key_equal()`, and to the hasher returned by
 
569
  `hash_function()`) is proportional to N in the average case and to N² in
570
  the worst case, where N is a.size(). For `unordered_multiset` and
571
  `unordered_multimap`, the complexity of `operator==` is proportional to
572
  $\sum E_i^2$ in the average case and to N² in the worst case, where N is
573
  `a.size()`, and Eᵢ is the size of the iᵗʰ equivalent-key group in `a`.
 
589
  unordered associative containers where the key type and value type are
590
  the same, both `iterator` and `const_iterator` are const iterators.
591
 
592
  The `insert` and `emplace` members shall not affect the validity of
593
  references to container elements, but may invalidate all iterators to
594
+ the container. The `erase` members shall invalidate only iterators and
595
+ references to the erased elements, and preserve the relative order of
596
+ the elements that are not erased.
597
 
598
  The `insert` and `emplace` members shall not affect the validity of
599
  iterators if `(N+n) < z * B`, where `N` is the number of elements in the
600
  container prior to the insert operation, `n` is the number of elements
601
  inserted, `B` is the container’s bucket count, and `z` is the