tmp/tmpkl3wug2g/{from.md → to.md}
RENAMED
|
@@ -17,19 +17,24 @@ function object type `Hash` that meets the `Hash` requirements (
|
|
| 17 |
of type `Key`, and by a binary predicate `Pred` that induces an
|
| 18 |
equivalence relation on values of type `Key`. Additionally,
|
| 19 |
`unordered_map` and `unordered_multimap` associate an arbitrary *mapped
|
| 20 |
type* `T` with the `Key`.
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
Two values `k1` and `k2` of type `Key` are considered equivalent if the
|
| 26 |
-
container’s
|
| 27 |
-
values. If `k1` and `k2` are equivalent, the hash function
|
| 28 |
-
the same value for both. Thus, when an unordered
|
| 29 |
-
is instantiated with a non-default `Pred`
|
| 30 |
-
non-default `Hash` parameter as well.
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
An unordered associative container supports *unique keys* if it may
|
| 33 |
contain at most one element for each key. Otherwise, it supports
|
| 34 |
*equivalent keys*. `unordered_set` and `unordered_map` support unique
|
| 35 |
keys. `unordered_multiset` and `unordered_multimap` support equivalent
|
|
@@ -45,10 +50,18 @@ unless otherwise specified.
|
|
| 45 |
For `unordered_set` and `unordered_multiset` the value type is the same
|
| 46 |
as the key type. For `unordered_map` and `unordered_multimap` it is
|
| 47 |
`std::pair<const Key,
|
| 48 |
T>`.
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
The elements of an unordered associative container are organized into
|
| 51 |
*buckets*. Keys with the same hash code appear in the same bucket. The
|
| 52 |
number of buckets is automatically increased as elements are added to an
|
| 53 |
unordered associative container, so that the average number of elements
|
| 54 |
per bucket is kept below a bound. Rehashing invalidates iterators,
|
|
@@ -83,15 +96,14 @@ type `float`.
|
|
| 83 |
|
| 84 |
Two unordered containers `a` and `b` compare equal if
|
| 85 |
`a.size() == b.size()` and, for every equivalent-key group \[`Ea1`,
|
| 86 |
`Ea2`) obtained from `a.equal_range(Ea1)`, there exists an
|
| 87 |
equivalent-key group \[`Eb1`, `Eb2`) obtained from `b.equal_range(Ea1)`,
|
| 88 |
-
such that `
|
| 89 |
-
`
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
returned by `key_equal()`, and to the hasher returned by
|
| 93 |
`hash_function()`) is proportional to N in the average case and to N² in
|
| 94 |
the worst case, where N is a.size(). For `unordered_multiset` and
|
| 95 |
`unordered_multimap`, the complexity of `operator==` is proportional to
|
| 96 |
$\sum E_i^2$ in the average case and to N² in the worst case, where N is
|
| 97 |
`a.size()`, and Eᵢ is the size of the iᵗʰ equivalent-key group in `a`.
|
|
@@ -113,12 +125,13 @@ associative container are of at least the forward iterator category. For
|
|
| 113 |
unordered associative containers where the key type and value type are
|
| 114 |
the same, both `iterator` and `const_iterator` are const iterators.
|
| 115 |
|
| 116 |
The `insert` and `emplace` members shall not affect the validity of
|
| 117 |
references to container elements, but may invalidate all iterators to
|
| 118 |
-
the container. The erase members shall invalidate only iterators and
|
| 119 |
-
references to the erased elements
|
|
|
|
| 120 |
|
| 121 |
The `insert` and `emplace` members shall not affect the validity of
|
| 122 |
iterators if `(N+n) < z * B`, where `N` is the number of elements in the
|
| 123 |
container prior to the insert operation, `n` is the number of elements
|
| 124 |
inserted, `B` is the container’s bucket count, and `z` is the
|
|
|
|
| 17 |
of type `Key`, and by a binary predicate `Pred` that induces an
|
| 18 |
equivalence relation on values of type `Key`. Additionally,
|
| 19 |
`unordered_map` and `unordered_multimap` associate an arbitrary *mapped
|
| 20 |
type* `T` with the `Key`.
|
| 21 |
|
| 22 |
+
The container’s object of type `Hash` — denoted by `hash` — is called
|
| 23 |
+
the *hash function* of the container. The container’s object of type
|
| 24 |
+
`Pred` — denoted by `pred` — is called the *key equality predicate* of
|
| 25 |
+
the container.
|
| 26 |
|
| 27 |
Two values `k1` and `k2` of type `Key` are considered equivalent if the
|
| 28 |
+
container’s key equality predicate returns `true` when passed those
|
| 29 |
+
values. If `k1` and `k2` are equivalent, the container’s hash function
|
| 30 |
+
shall return the same value for both. Thus, when an unordered
|
| 31 |
+
associative container is instantiated with a non-default `Pred`
|
| 32 |
+
parameter it usually needs a non-default `Hash` parameter as well. For
|
| 33 |
+
any two keys `k1` and `k2` in the same container, calling `pred(k1, k2)`
|
| 34 |
+
shall always return the same value. For any key `k` in a container,
|
| 35 |
+
calling `hash(k)` shall always return the same value.
|
| 36 |
|
| 37 |
An unordered associative container supports *unique keys* if it may
|
| 38 |
contain at most one element for each key. Otherwise, it supports
|
| 39 |
*equivalent keys*. `unordered_set` and `unordered_map` support unique
|
| 40 |
keys. `unordered_multiset` and `unordered_multimap` support equivalent
|
|
|
|
| 50 |
For `unordered_set` and `unordered_multiset` the value type is the same
|
| 51 |
as the key type. For `unordered_map` and `unordered_multimap` it is
|
| 52 |
`std::pair<const Key,
|
| 53 |
T>`.
|
| 54 |
|
| 55 |
+
For unordered containers where the value type is the same as the key
|
| 56 |
+
type, both `iterator` and `const_iterator` are constant iterators. It is
|
| 57 |
+
unspecified whether or not `iterator` and `const_iterator` are the same
|
| 58 |
+
type. `iterator` and `const_iterator` have identical semantics in this
|
| 59 |
+
case, and `iterator` is convertible to `const_iterator`. Users can avoid
|
| 60 |
+
violating the One Definition Rule by always using `const_iterator` in
|
| 61 |
+
their function parameter lists.
|
| 62 |
+
|
| 63 |
The elements of an unordered associative container are organized into
|
| 64 |
*buckets*. Keys with the same hash code appear in the same bucket. The
|
| 65 |
number of buckets is automatically increased as elements are added to an
|
| 66 |
unordered associative container, so that the average number of elements
|
| 67 |
per bucket is kept below a bound. Rehashing invalidates iterators,
|
|
|
|
| 96 |
|
| 97 |
Two unordered containers `a` and `b` compare equal if
|
| 98 |
`a.size() == b.size()` and, for every equivalent-key group \[`Ea1`,
|
| 99 |
`Ea2`) obtained from `a.equal_range(Ea1)`, there exists an
|
| 100 |
equivalent-key group \[`Eb1`, `Eb2`) obtained from `b.equal_range(Ea1)`,
|
| 101 |
+
such that `is_permutation(Ea1, Ea2, Eb1, Eb2)` returns `true`. For
|
| 102 |
+
`unordered_set` and `unordered_map`, the complexity of `operator==`
|
| 103 |
+
(i.e., the number of calls to the `==` operator of the `value_type`, to
|
| 104 |
+
the predicate returned by `key_equal()`, and to the hasher returned by
|
|
|
|
| 105 |
`hash_function()`) is proportional to N in the average case and to N² in
|
| 106 |
the worst case, where N is a.size(). For `unordered_multiset` and
|
| 107 |
`unordered_multimap`, the complexity of `operator==` is proportional to
|
| 108 |
$\sum E_i^2$ in the average case and to N² in the worst case, where N is
|
| 109 |
`a.size()`, and Eᵢ is the size of the iᵗʰ equivalent-key group in `a`.
|
|
|
|
| 125 |
unordered associative containers where the key type and value type are
|
| 126 |
the same, both `iterator` and `const_iterator` are const iterators.
|
| 127 |
|
| 128 |
The `insert` and `emplace` members shall not affect the validity of
|
| 129 |
references to container elements, but may invalidate all iterators to
|
| 130 |
+
the container. The `erase` members shall invalidate only iterators and
|
| 131 |
+
references to the erased elements, and preserve the relative order of
|
| 132 |
+
the elements that are not erased.
|
| 133 |
|
| 134 |
The `insert` and `emplace` members shall not affect the validity of
|
| 135 |
iterators if `(N+n) < z * B`, where `N` is the number of elements in the
|
| 136 |
container prior to the insert operation, `n` is the number of elements
|
| 137 |
inserted, `B` is the container’s bucket count, and `z` is the
|