tmp/tmpd0a3zat2/{from.md → to.md}
RENAMED
|
@@ -87,17 +87,17 @@ In this subclause,
|
|
| 87 |
- `a_tran` denotes a value of type `X` or `const X` when the
|
| 88 |
*qualified-id*s `X::key_equal::is_transparent` and
|
| 89 |
`X::hasher::is_transparent` are both valid and denote types
|
| 90 |
[[temp.deduct]],
|
| 91 |
- `i` and `j` denote input iterators that refer to `value_type`,
|
| 92 |
-
-
|
| 93 |
- `rg` denotes a value of a type `R` that models
|
| 94 |
`container-compatible-range<value_type>`,
|
| 95 |
- `p` and `q2` denote valid constant iterators to `a`,
|
| 96 |
- `q` and `q1` denote valid dereferenceable constant iterators to `a`,
|
| 97 |
- `r` denotes a valid dereferenceable iterator to `a`,
|
| 98 |
-
-
|
| 99 |
- `il` denotes a value of type `initializer_list<value_type>`,
|
| 100 |
- `t` denotes a value of type `X::value_type`,
|
| 101 |
- `k` denotes a value of type `key_type`,
|
| 102 |
- `hf` denotes a value of type `hasher` or `const hasher`,
|
| 103 |
- `eq` denotes a value of type `key_equal` or `const key_equal`,
|
|
@@ -120,19 +120,19 @@ In this subclause,
|
|
| 120 |
- `z` denotes a value of type `float`, and
|
| 121 |
- `nh` denotes an rvalue of type `X::node_type`.
|
| 122 |
|
| 123 |
A type `X` meets the *unordered associative container* requirements if
|
| 124 |
`X` meets all the requirements of an allocator-aware container
|
| 125 |
-
[[container.
|
| 126 |
-
|
| 127 |
that for `unordered_map` and `unordered_multimap`, the requirements
|
| 128 |
-
placed on `value_type` in [[container.
|
| 129 |
`key_type` and `mapped_type`.
|
| 130 |
|
| 131 |
-
[*Note 3*: For example, `key_type` and `mapped_type`
|
| 132 |
-
|
| 133 |
-
`
|
| 134 |
*Cpp17CopyAssignable*. — *end note*]
|
| 135 |
|
| 136 |
``` cpp
|
| 137 |
typename X::key_type
|
| 138 |
```
|
|
@@ -399,12 +399,12 @@ X(il, n, hf, eq)
|
|
| 399 |
``` cpp
|
| 400 |
X(b)
|
| 401 |
```
|
| 402 |
|
| 403 |
*Effects:* In addition to the container
|
| 404 |
-
requirements [[container.
|
| 405 |
-
|
| 406 |
|
| 407 |
*Complexity:* Average case linear in `b.size()`, worst case quadratic.
|
| 408 |
|
| 409 |
``` cpp
|
| 410 |
a = b
|
|
@@ -490,21 +490,15 @@ from `args`.
|
|
| 490 |
a.emplace_hint(p, args)
|
| 491 |
```
|
| 492 |
|
| 493 |
*Result:* `iterator`
|
| 494 |
|
| 495 |
-
*
|
| 496 |
-
|
|
|
|
| 497 |
|
| 498 |
-
*
|
| 499 |
-
|
| 500 |
-
*Returns:* An iterator pointing to the element with the key equivalent
|
| 501 |
-
to the newly inserted element. The `const_iterator` `p` is a hint
|
| 502 |
-
pointing to where the search should start. Implementations are permitted
|
| 503 |
-
to ignore the hint.
|
| 504 |
-
|
| 505 |
-
*Complexity:* Average case 𝑂(1), worst case 𝑂(`a.size()`).
|
| 506 |
|
| 507 |
``` cpp
|
| 508 |
a_uniq.insert(t)
|
| 509 |
```
|
| 510 |
|
|
@@ -565,11 +559,11 @@ a.insert(i, j)
|
|
| 565 |
*Result:* `void`
|
| 566 |
|
| 567 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
|
| 568 |
from `*i`. Neither `i` nor `j` are iterators into `a`.
|
| 569 |
|
| 570 |
-
*Effects:* Equivalent to `a.insert(t)` for each element in
|
| 571 |
|
| 572 |
*Complexity:* Average case 𝑂(N), where N is `distance(i, j)`, worst case
|
| 573 |
𝑂(N(`a.size()` + 1)).
|
| 574 |
|
| 575 |
``` cpp
|
|
@@ -771,11 +765,11 @@ a.erase(r)
|
|
| 771 |
a.erase(q1, q2)
|
| 772 |
```
|
| 773 |
|
| 774 |
*Result:* `iterator`
|
| 775 |
|
| 776 |
-
*Effects:* Erases all elements in the range
|
| 777 |
|
| 778 |
*Returns:* The iterator immediately following the erased elements prior
|
| 779 |
to the erasure.
|
| 780 |
|
| 781 |
*Complexity:* Average case linear in `distance(q1, q2)`, worst case
|
|
@@ -903,21 +897,37 @@ b.bucket(k)
|
|
| 903 |
|
| 904 |
*Preconditions:* `b.bucket_count() > 0`.
|
| 905 |
|
| 906 |
*Returns:* The index of the bucket in which elements with keys
|
| 907 |
equivalent to `k` would be found, if any such element existed. The
|
| 908 |
-
return value is in the range
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
|
| 910 |
*Complexity:* Constant.
|
| 911 |
|
| 912 |
``` cpp
|
| 913 |
b.bucket_size(n)
|
| 914 |
```
|
| 915 |
|
| 916 |
*Result:* `size_type`
|
| 917 |
|
| 918 |
-
*Preconditions:* `n` shall be in the range
|
| 919 |
|
| 920 |
*Returns:* The number of elements in the `n`ᵗʰ bucket.
|
| 921 |
|
| 922 |
*Complexity:* 𝑂(`b.bucket_size(n)`)
|
| 923 |
|
|
@@ -925,11 +935,11 @@ b.bucket_size(n)
|
|
| 925 |
b.begin(n)
|
| 926 |
```
|
| 927 |
|
| 928 |
*Result:* `local_iterator`; `const_local_iterator` for constant `b`.
|
| 929 |
|
| 930 |
-
*Preconditions:* `n` is in the range
|
| 931 |
|
| 932 |
*Returns:* An iterator referring to the first element in the bucket. If
|
| 933 |
the bucket is empty, then `b.begin(n) == b.end(n)`.
|
| 934 |
|
| 935 |
*Complexity:* Constant.
|
|
@@ -938,11 +948,11 @@ the bucket is empty, then `b.begin(n) == b.end(n)`.
|
|
| 938 |
b.end(n)
|
| 939 |
```
|
| 940 |
|
| 941 |
*Result:* `local_iterator`; `const_local_iterator` for constant `b`.
|
| 942 |
|
| 943 |
-
*Preconditions:* `n` is in the range
|
| 944 |
|
| 945 |
*Returns:* An iterator which is the past-the-end value for the bucket.
|
| 946 |
|
| 947 |
*Complexity:* Constant.
|
| 948 |
|
|
@@ -950,11 +960,11 @@ b.end(n)
|
|
| 950 |
b.cbegin(n)
|
| 951 |
```
|
| 952 |
|
| 953 |
*Result:* `const_local_iterator`
|
| 954 |
|
| 955 |
-
*Preconditions:* `n` shall be in the range
|
| 956 |
|
| 957 |
*Returns:* An iterator referring to the first element in the bucket. If
|
| 958 |
the bucket is empty, then `b.cbegin(n) == b.cend(n)`.
|
| 959 |
|
| 960 |
*Complexity:* Constant.
|
|
@@ -963,11 +973,11 @@ the bucket is empty, then `b.cbegin(n) == b.cend(n)`.
|
|
| 963 |
b.cend(n)
|
| 964 |
```
|
| 965 |
|
| 966 |
*Result:* `const_local_iterator`
|
| 967 |
|
| 968 |
-
*Preconditions:* `n` is in the range
|
| 969 |
|
| 970 |
*Returns:* An iterator which is the past-the-end value for the bucket.
|
| 971 |
|
| 972 |
*Complexity:* Constant.
|
| 973 |
|
|
@@ -1072,15 +1082,15 @@ accessing the element through such pointers and references while the
|
|
| 1072 |
element is owned by a `node_type` is undefined behavior. References and
|
| 1073 |
pointers to an element obtained while it is owned by a `node_type` are
|
| 1074 |
invalidated if the element is successfully inserted.
|
| 1075 |
|
| 1076 |
The member function templates `find`, `count`, `equal_range`,
|
| 1077 |
-
`contains`, `extract`, and `
|
| 1078 |
-
resolution unless the *qualified-id*s `Pred::is_transparent`
|
| 1079 |
-
`Hash::is_transparent` are both valid and denote types
|
| 1080 |
-
Additionally, the member function templates `extract`
|
| 1081 |
-
not participate in overload resolution if
|
| 1082 |
`is_convertible_v<K&&, iterator> || is_convertible_v<K&&, const_iterator>`
|
| 1083 |
is `true`, where `K` is the type substituted as the first template
|
| 1084 |
argument.
|
| 1085 |
|
| 1086 |
A deduction guide for an unordered associative container shall not
|
|
|
|
| 87 |
- `a_tran` denotes a value of type `X` or `const X` when the
|
| 88 |
*qualified-id*s `X::key_equal::is_transparent` and
|
| 89 |
`X::hasher::is_transparent` are both valid and denote types
|
| 90 |
[[temp.deduct]],
|
| 91 |
- `i` and `j` denote input iterators that refer to `value_type`,
|
| 92 |
+
- \[`i`, `j`) denotes a valid range,
|
| 93 |
- `rg` denotes a value of a type `R` that models
|
| 94 |
`container-compatible-range<value_type>`,
|
| 95 |
- `p` and `q2` denote valid constant iterators to `a`,
|
| 96 |
- `q` and `q1` denote valid dereferenceable constant iterators to `a`,
|
| 97 |
- `r` denotes a valid dereferenceable iterator to `a`,
|
| 98 |
+
- \[`q1`, `q2`) denotes a valid range in `a`,
|
| 99 |
- `il` denotes a value of type `initializer_list<value_type>`,
|
| 100 |
- `t` denotes a value of type `X::value_type`,
|
| 101 |
- `k` denotes a value of type `key_type`,
|
| 102 |
- `hf` denotes a value of type `hasher` or `const hasher`,
|
| 103 |
- `eq` denotes a value of type `key_equal` or `const key_equal`,
|
|
|
|
| 120 |
- `z` denotes a value of type `float`, and
|
| 121 |
- `nh` denotes an rvalue of type `X::node_type`.
|
| 122 |
|
| 123 |
A type `X` meets the *unordered associative container* requirements if
|
| 124 |
`X` meets all the requirements of an allocator-aware container
|
| 125 |
+
[[container.alloc.reqmts]] and the following types, statements, and
|
| 126 |
+
expressions are well-formed and have the specified semantics, except
|
| 127 |
that for `unordered_map` and `unordered_multimap`, the requirements
|
| 128 |
+
placed on `value_type` in [[container.reqmts]] apply instead to
|
| 129 |
`key_type` and `mapped_type`.
|
| 130 |
|
| 131 |
+
[*Note 3*: For example, `key_type` and `mapped_type` sometimes need to
|
| 132 |
+
be *Cpp17CopyAssignable* even though the associated `value_type`,
|
| 133 |
+
`pair<const key_type, mapped_type>`, is not
|
| 134 |
*Cpp17CopyAssignable*. — *end note*]
|
| 135 |
|
| 136 |
``` cpp
|
| 137 |
typename X::key_type
|
| 138 |
```
|
|
|
|
| 399 |
``` cpp
|
| 400 |
X(b)
|
| 401 |
```
|
| 402 |
|
| 403 |
*Effects:* In addition to the container
|
| 404 |
+
requirements [[container.reqmts]], copies the hash function, predicate,
|
| 405 |
+
and maximum load factor.
|
| 406 |
|
| 407 |
*Complexity:* Average case linear in `b.size()`, worst case quadratic.
|
| 408 |
|
| 409 |
``` cpp
|
| 410 |
a = b
|
|
|
|
| 490 |
a.emplace_hint(p, args)
|
| 491 |
```
|
| 492 |
|
| 493 |
*Result:* `iterator`
|
| 494 |
|
| 495 |
+
*Effects:* Equivalent to `a.emplace(std::forward<Args>(args)...)`,
|
| 496 |
+
except that the `const_iterator` `p` is a hint pointing to where the
|
| 497 |
+
search should start. Implementations are permitted to ignore the hint.
|
| 498 |
|
| 499 |
+
*Returns:* The iterator returned by `emplace`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
|
| 501 |
``` cpp
|
| 502 |
a_uniq.insert(t)
|
| 503 |
```
|
| 504 |
|
|
|
|
| 559 |
*Result:* `void`
|
| 560 |
|
| 561 |
*Preconditions:* `value_type` is *Cpp17EmplaceConstructible* into `X`
|
| 562 |
from `*i`. Neither `i` nor `j` are iterators into `a`.
|
| 563 |
|
| 564 |
+
*Effects:* Equivalent to `a.insert(t)` for each element in \[`i`, `j`).
|
| 565 |
|
| 566 |
*Complexity:* Average case 𝑂(N), where N is `distance(i, j)`, worst case
|
| 567 |
𝑂(N(`a.size()` + 1)).
|
| 568 |
|
| 569 |
``` cpp
|
|
|
|
| 765 |
a.erase(q1, q2)
|
| 766 |
```
|
| 767 |
|
| 768 |
*Result:* `iterator`
|
| 769 |
|
| 770 |
+
*Effects:* Erases all elements in the range \[`q1`, `q2`).
|
| 771 |
|
| 772 |
*Returns:* The iterator immediately following the erased elements prior
|
| 773 |
to the erasure.
|
| 774 |
|
| 775 |
*Complexity:* Average case linear in `distance(q1, q2)`, worst case
|
|
|
|
| 897 |
|
| 898 |
*Preconditions:* `b.bucket_count() > 0`.
|
| 899 |
|
| 900 |
*Returns:* The index of the bucket in which elements with keys
|
| 901 |
equivalent to `k` would be found, if any such element existed. The
|
| 902 |
+
return value is in the range \[`0`, `b.bucket_count()`).
|
| 903 |
+
|
| 904 |
+
*Complexity:* Constant.
|
| 905 |
+
|
| 906 |
+
``` cpp
|
| 907 |
+
a_tran.bucket(ke)
|
| 908 |
+
```
|
| 909 |
+
|
| 910 |
+
*Result:* `size_type`
|
| 911 |
+
|
| 912 |
+
*Preconditions:* `a_tran.bucket_count() > 0`.
|
| 913 |
+
|
| 914 |
+
*Ensures:* The return value is in the range \[`0`,
|
| 915 |
+
`a_tran.bucket_count()`).
|
| 916 |
+
|
| 917 |
+
*Returns:* The index of the bucket in which elements with keys
|
| 918 |
+
equivalent to `ke` would be found, if any such element existed.
|
| 919 |
|
| 920 |
*Complexity:* Constant.
|
| 921 |
|
| 922 |
``` cpp
|
| 923 |
b.bucket_size(n)
|
| 924 |
```
|
| 925 |
|
| 926 |
*Result:* `size_type`
|
| 927 |
|
| 928 |
+
*Preconditions:* `n` shall be in the range \[`0`, `b.bucket_count()`).
|
| 929 |
|
| 930 |
*Returns:* The number of elements in the `n`ᵗʰ bucket.
|
| 931 |
|
| 932 |
*Complexity:* 𝑂(`b.bucket_size(n)`)
|
| 933 |
|
|
|
|
| 935 |
b.begin(n)
|
| 936 |
```
|
| 937 |
|
| 938 |
*Result:* `local_iterator`; `const_local_iterator` for constant `b`.
|
| 939 |
|
| 940 |
+
*Preconditions:* `n` is in the range \[`0`, `b.bucket_count()`).
|
| 941 |
|
| 942 |
*Returns:* An iterator referring to the first element in the bucket. If
|
| 943 |
the bucket is empty, then `b.begin(n) == b.end(n)`.
|
| 944 |
|
| 945 |
*Complexity:* Constant.
|
|
|
|
| 948 |
b.end(n)
|
| 949 |
```
|
| 950 |
|
| 951 |
*Result:* `local_iterator`; `const_local_iterator` for constant `b`.
|
| 952 |
|
| 953 |
+
*Preconditions:* `n` is in the range \[`0`, `b.bucket_count()`).
|
| 954 |
|
| 955 |
*Returns:* An iterator which is the past-the-end value for the bucket.
|
| 956 |
|
| 957 |
*Complexity:* Constant.
|
| 958 |
|
|
|
|
| 960 |
b.cbegin(n)
|
| 961 |
```
|
| 962 |
|
| 963 |
*Result:* `const_local_iterator`
|
| 964 |
|
| 965 |
+
*Preconditions:* `n` shall be in the range \[`0`, `b.bucket_count()`).
|
| 966 |
|
| 967 |
*Returns:* An iterator referring to the first element in the bucket. If
|
| 968 |
the bucket is empty, then `b.cbegin(n) == b.cend(n)`.
|
| 969 |
|
| 970 |
*Complexity:* Constant.
|
|
|
|
| 973 |
b.cend(n)
|
| 974 |
```
|
| 975 |
|
| 976 |
*Result:* `const_local_iterator`
|
| 977 |
|
| 978 |
+
*Preconditions:* `n` is in the range \[`0`, `b.bucket_count()`).
|
| 979 |
|
| 980 |
*Returns:* An iterator which is the past-the-end value for the bucket.
|
| 981 |
|
| 982 |
*Complexity:* Constant.
|
| 983 |
|
|
|
|
| 1082 |
element is owned by a `node_type` is undefined behavior. References and
|
| 1083 |
pointers to an element obtained while it is owned by a `node_type` are
|
| 1084 |
invalidated if the element is successfully inserted.
|
| 1085 |
|
| 1086 |
The member function templates `find`, `count`, `equal_range`,
|
| 1087 |
+
`contains`, `extract`, `erase`, and `bucket` shall not participate in
|
| 1088 |
+
overload resolution unless the *qualified-id*s `Pred::is_transparent`
|
| 1089 |
+
and `Hash::is_transparent` are both valid and denote types
|
| 1090 |
+
[[temp.deduct]]. Additionally, the member function templates `extract`
|
| 1091 |
+
and `erase` shall not participate in overload resolution if
|
| 1092 |
`is_convertible_v<K&&, iterator> || is_convertible_v<K&&, const_iterator>`
|
| 1093 |
is `true`, where `K` is the type substituted as the first template
|
| 1094 |
argument.
|
| 1095 |
|
| 1096 |
A deduction guide for an unordered associative container shall not
|