tmp/tmp_1nhuuwc/{from.md → to.md}
RENAMED
|
@@ -3,18 +3,18 @@
|
|
| 3 |
An `unordered_map` is an unordered associative container that supports
|
| 4 |
unique keys (an `unordered_map` contains at most one of each key value)
|
| 5 |
and that associates values of another type `mapped_type` with the keys.
|
| 6 |
The `unordered_map` class supports forward iterators.
|
| 7 |
|
| 8 |
-
An `unordered_map` meets all of the requirements of a container
|
| 9 |
-
|
| 10 |
-
[[container.alloc.
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
`
|
| 14 |
-
`Key
|
| 15 |
-
`pair<const Key, T>`.
|
| 16 |
|
| 17 |
Subclause [[unord.map]] only describes operations on `unordered_map`
|
| 18 |
that are not described in one of the requirement tables, or for which
|
| 19 |
there is additional semantic information.
|
| 20 |
|
|
@@ -36,12 +36,12 @@ namespace std {
|
|
| 36 |
using allocator_type = Allocator;
|
| 37 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 38 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 39 |
using reference = value_type&;
|
| 40 |
using const_reference = const value_type&;
|
| 41 |
-
using size_type = implementation-defined; // see [container.requirements]
|
| 42 |
-
using difference_type = implementation-defined; // see [container.requirements]
|
| 43 |
|
| 44 |
using iterator = implementation-defined // type of unordered_map::iterator; // see [container.requirements]
|
| 45 |
using const_iterator = implementation-defined // type of unordered_map::const_iterator; // see [container.requirements]
|
| 46 |
using local_iterator = implementation-defined // type of unordered_map::local_iterator; // see [container.requirements]
|
| 47 |
using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
|
|
@@ -58,15 +58,20 @@ namespace std {
|
|
| 58 |
unordered_map(InputIterator f, InputIterator l,
|
| 59 |
size_type n = see below,
|
| 60 |
const hasher& hf = hasher(),
|
| 61 |
const key_equal& eql = key_equal(),
|
| 62 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
unordered_map(const unordered_map&);
|
| 64 |
unordered_map(unordered_map&&);
|
| 65 |
explicit unordered_map(const Allocator&);
|
| 66 |
-
unordered_map(const unordered_map&, const Allocator&);
|
| 67 |
-
unordered_map(unordered_map&&, const Allocator&);
|
| 68 |
unordered_map(initializer_list<value_type> il,
|
| 69 |
size_type n = see below,
|
| 70 |
const hasher& hf = hasher(),
|
| 71 |
const key_equal& eql = key_equal(),
|
| 72 |
const allocator_type& a = allocator_type());
|
|
@@ -79,10 +84,16 @@ namespace std {
|
|
| 79 |
: unordered_map(f, l, n, hasher(), key_equal(), a) { }
|
| 80 |
template<class InputIterator>
|
| 81 |
unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 82 |
const allocator_type& a)
|
| 83 |
: unordered_map(f, l, n, hf, key_equal(), a) { }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 85 |
: unordered_map(il, n, hasher(), key_equal(), a) { }
|
| 86 |
unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 87 |
const allocator_type& a)
|
| 88 |
: unordered_map(il, n, hf, key_equal(), a) { }
|
|
@@ -116,14 +127,17 @@ namespace std {
|
|
| 116 |
template<class P> pair<iterator, bool> insert(P&& obj);
|
| 117 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 118 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 119 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 120 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
|
|
|
|
|
|
| 121 |
void insert(initializer_list<value_type>);
|
| 122 |
|
| 123 |
node_type extract(const_iterator position);
|
| 124 |
node_type extract(const key_type& x);
|
|
|
|
| 125 |
insert_return_type insert(node_type&& nh);
|
| 126 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 127 |
|
| 128 |
template<class... Args>
|
| 129 |
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
|
@@ -143,10 +157,11 @@ namespace std {
|
|
| 143 |
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 144 |
|
| 145 |
iterator erase(iterator position);
|
| 146 |
iterator erase(const_iterator position);
|
| 147 |
size_type erase(const key_type& k);
|
|
|
|
| 148 |
iterator erase(const_iterator first, const_iterator last);
|
| 149 |
void swap(unordered_map&)
|
| 150 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 151 |
is_nothrow_swappable_v<Hash> &&
|
| 152 |
is_nothrow_swappable_v<Pred>);
|
|
@@ -170,11 +185,10 @@ namespace std {
|
|
| 170 |
const_iterator find(const key_type& k) const;
|
| 171 |
template<class K>
|
| 172 |
iterator find(const K& k);
|
| 173 |
template<class K>
|
| 174 |
const_iterator find(const K& k) const;
|
| 175 |
-
template<class K>
|
| 176 |
size_type count(const key_type& k) const;
|
| 177 |
template<class K>
|
| 178 |
size_type count(const K& k) const;
|
| 179 |
bool contains(const key_type& k) const;
|
| 180 |
template<class K>
|
|
@@ -219,10 +233,17 @@ namespace std {
|
|
| 219 |
unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 220 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 221 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash, Pred,
|
| 222 |
Allocator>;
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
template<class Key, class T, class Hash = hash<Key>,
|
| 225 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 226 |
unordered_map(initializer_list<pair<Key, T>>,
|
| 227 |
typename see below::size_type = see below, Hash = Hash(),
|
| 228 |
Pred = Pred(), Allocator = Allocator())
|
|
@@ -243,10 +264,25 @@ namespace std {
|
|
| 243 |
template<class InputIterator, class Hash, class Allocator>
|
| 244 |
unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
|
| 245 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 246 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
template<class Key, class T, class Allocator>
|
| 249 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 250 |
Allocator)
|
| 251 |
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 252 |
|
|
@@ -256,16 +292,10 @@ namespace std {
|
|
| 256 |
|
| 257 |
template<class Key, class T, class Hash, class Allocator>
|
| 258 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type, Hash,
|
| 259 |
Allocator)
|
| 260 |
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
|
| 261 |
-
|
| 262 |
-
// swap
|
| 263 |
-
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 264 |
-
void swap(unordered_map<Key, T, Hash, Pred, Alloc>& x,
|
| 265 |
-
unordered_map<Key, T, Hash, Pred, Alloc>& y)
|
| 266 |
-
noexcept(noexcept(x.swap(y)));
|
| 267 |
}
|
| 268 |
```
|
| 269 |
|
| 270 |
A `size_type` parameter type in an `unordered_map` deduction guide
|
| 271 |
refers to the `size_type` member type of the type deduced by the
|
|
|
|
| 3 |
An `unordered_map` is an unordered associative container that supports
|
| 4 |
unique keys (an `unordered_map` contains at most one of each key value)
|
| 5 |
and that associates values of another type `mapped_type` with the keys.
|
| 6 |
The `unordered_map` class supports forward iterators.
|
| 7 |
|
| 8 |
+
An `unordered_map` meets all of the requirements of a container
|
| 9 |
+
[[container.reqmts]], of an allocator-aware container
|
| 10 |
+
[[container.alloc.reqmts]], and of an unordered associative container
|
| 11 |
+
[[unord.req]]. It provides the operations described in the preceding
|
| 12 |
+
requirements table for unique keys; that is, an `unordered_map` supports
|
| 13 |
+
the `a_uniq` operations in that table, not the `a_eq` operations. For an
|
| 14 |
+
`unordered_map<Key, T>` the `key_type` is `Key`, the `mapped_type` is
|
| 15 |
+
`T`, and the `value_type` is `pair<const Key, T>`.
|
| 16 |
|
| 17 |
Subclause [[unord.map]] only describes operations on `unordered_map`
|
| 18 |
that are not described in one of the requirement tables, or for which
|
| 19 |
there is additional semantic information.
|
| 20 |
|
|
|
|
| 36 |
using allocator_type = Allocator;
|
| 37 |
using pointer = typename allocator_traits<Allocator>::pointer;
|
| 38 |
using const_pointer = typename allocator_traits<Allocator>::const_pointer;
|
| 39 |
using reference = value_type&;
|
| 40 |
using const_reference = const value_type&;
|
| 41 |
+
using size_type = implementation-defined // type of unordered_map::size_type; // see [container.requirements]
|
| 42 |
+
using difference_type = implementation-defined // type of unordered_map::difference_type; // see [container.requirements]
|
| 43 |
|
| 44 |
using iterator = implementation-defined // type of unordered_map::iterator; // see [container.requirements]
|
| 45 |
using const_iterator = implementation-defined // type of unordered_map::const_iterator; // see [container.requirements]
|
| 46 |
using local_iterator = implementation-defined // type of unordered_map::local_iterator; // see [container.requirements]
|
| 47 |
using const_local_iterator = implementation-defined // type of unordered_map::const_local_iterator; // see [container.requirements]
|
|
|
|
| 58 |
unordered_map(InputIterator f, InputIterator l,
|
| 59 |
size_type n = see below,
|
| 60 |
const hasher& hf = hasher(),
|
| 61 |
const key_equal& eql = key_equal(),
|
| 62 |
const allocator_type& a = allocator_type());
|
| 63 |
+
|
| 64 |
+
template<container-compatible-range<value_type> R>
|
| 65 |
+
unordered_map(from_range_t, R&& rg, size_type n = see below,
|
| 66 |
+
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
|
| 67 |
+
const allocator_type& a = allocator_type());
|
| 68 |
unordered_map(const unordered_map&);
|
| 69 |
unordered_map(unordered_map&&);
|
| 70 |
explicit unordered_map(const Allocator&);
|
| 71 |
+
unordered_map(const unordered_map&, const type_identity_t<Allocator>&);
|
| 72 |
+
unordered_map(unordered_map&&, const type_identity_t<Allocator>&);
|
| 73 |
unordered_map(initializer_list<value_type> il,
|
| 74 |
size_type n = see below,
|
| 75 |
const hasher& hf = hasher(),
|
| 76 |
const key_equal& eql = key_equal(),
|
| 77 |
const allocator_type& a = allocator_type());
|
|
|
|
| 84 |
: unordered_map(f, l, n, hasher(), key_equal(), a) { }
|
| 85 |
template<class InputIterator>
|
| 86 |
unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 87 |
const allocator_type& a)
|
| 88 |
: unordered_map(f, l, n, hf, key_equal(), a) { }
|
| 89 |
+
template<container-compatible-range<value_type> R>
|
| 90 |
+
unordered_map(from_range_t, R&& rg, size_type n, const allocator_type& a)
|
| 91 |
+
: unordered_map(from_range, std::forward<R>(rg), n, hasher(), key_equal(), a) { }
|
| 92 |
+
template<container-compatible-range<value_type> R>
|
| 93 |
+
unordered_map(from_range_t, R&& rg, size_type n, const hasher& hf, const allocator_type& a)
|
| 94 |
+
: unordered_map(from_range, std::forward<R>(rg), n, hf, key_equal(), a) { }
|
| 95 |
unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 96 |
: unordered_map(il, n, hasher(), key_equal(), a) { }
|
| 97 |
unordered_map(initializer_list<value_type> il, size_type n, const hasher& hf,
|
| 98 |
const allocator_type& a)
|
| 99 |
: unordered_map(il, n, hf, key_equal(), a) { }
|
|
|
|
| 127 |
template<class P> pair<iterator, bool> insert(P&& obj);
|
| 128 |
iterator insert(const_iterator hint, const value_type& obj);
|
| 129 |
iterator insert(const_iterator hint, value_type&& obj);
|
| 130 |
template<class P> iterator insert(const_iterator hint, P&& obj);
|
| 131 |
template<class InputIterator> void insert(InputIterator first, InputIterator last);
|
| 132 |
+
template<container-compatible-range<value_type> R>
|
| 133 |
+
void insert_range(R&& rg);
|
| 134 |
void insert(initializer_list<value_type>);
|
| 135 |
|
| 136 |
node_type extract(const_iterator position);
|
| 137 |
node_type extract(const key_type& x);
|
| 138 |
+
template<class K> node_type extract(K&& x);
|
| 139 |
insert_return_type insert(node_type&& nh);
|
| 140 |
iterator insert(const_iterator hint, node_type&& nh);
|
| 141 |
|
| 142 |
template<class... Args>
|
| 143 |
pair<iterator, bool> try_emplace(const key_type& k, Args&&... args);
|
|
|
|
| 157 |
iterator insert_or_assign(const_iterator hint, key_type&& k, M&& obj);
|
| 158 |
|
| 159 |
iterator erase(iterator position);
|
| 160 |
iterator erase(const_iterator position);
|
| 161 |
size_type erase(const key_type& k);
|
| 162 |
+
template<class K> size_type erase(K&& x);
|
| 163 |
iterator erase(const_iterator first, const_iterator last);
|
| 164 |
void swap(unordered_map&)
|
| 165 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 166 |
is_nothrow_swappable_v<Hash> &&
|
| 167 |
is_nothrow_swappable_v<Pred>);
|
|
|
|
| 185 |
const_iterator find(const key_type& k) const;
|
| 186 |
template<class K>
|
| 187 |
iterator find(const K& k);
|
| 188 |
template<class K>
|
| 189 |
const_iterator find(const K& k) const;
|
|
|
|
| 190 |
size_type count(const key_type& k) const;
|
| 191 |
template<class K>
|
| 192 |
size_type count(const K& k) const;
|
| 193 |
bool contains(const key_type& k) const;
|
| 194 |
template<class K>
|
|
|
|
| 233 |
unordered_map(InputIterator, InputIterator, typename see below::size_type = see below,
|
| 234 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 235 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash, Pred,
|
| 236 |
Allocator>;
|
| 237 |
|
| 238 |
+
template<ranges::input_range R, class Hash = hash<range-key-type<R>>,
|
| 239 |
+
class Pred = equal_to<range-key-type<R>>,
|
| 240 |
+
class Allocator = allocator<range-to-alloc-type<R>>>
|
| 241 |
+
unordered_map(from_range_t, R&&, typename see below::size_type = see below,
|
| 242 |
+
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 243 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, Hash, Pred, Allocator>;
|
| 244 |
+
|
| 245 |
template<class Key, class T, class Hash = hash<Key>,
|
| 246 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 247 |
unordered_map(initializer_list<pair<Key, T>>,
|
| 248 |
typename see below::size_type = see below, Hash = Hash(),
|
| 249 |
Pred = Pred(), Allocator = Allocator())
|
|
|
|
| 264 |
template<class InputIterator, class Hash, class Allocator>
|
| 265 |
unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator)
|
| 266 |
-> unordered_map<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 267 |
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 268 |
|
| 269 |
+
template<ranges::input_range R, class Allocator>
|
| 270 |
+
unordered_map(from_range_t, R&&, typename see below::size_type, Allocator)
|
| 271 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 272 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 273 |
+
|
| 274 |
+
template<ranges::input_range R, class Allocator>
|
| 275 |
+
unordered_map(from_range_t, R&&, Allocator)
|
| 276 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, hash<range-key-type<R>>,
|
| 277 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 278 |
+
|
| 279 |
+
template<ranges::input_range R, class Hash, class Allocator>
|
| 280 |
+
unordered_map(from_range_t, R&&, typename see below::size_type, Hash, Allocator)
|
| 281 |
+
-> unordered_map<range-key-type<R>, range-mapped-type<R>, Hash,
|
| 282 |
+
equal_to<range-key-type<R>>, Allocator>;
|
| 283 |
+
|
| 284 |
template<class Key, class T, class Allocator>
|
| 285 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 286 |
Allocator)
|
| 287 |
-> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 288 |
|
|
|
|
| 292 |
|
| 293 |
template<class Key, class T, class Hash, class Allocator>
|
| 294 |
unordered_map(initializer_list<pair<Key, T>>, typename see below::size_type, Hash,
|
| 295 |
Allocator)
|
| 296 |
-> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
}
|
| 298 |
```
|
| 299 |
|
| 300 |
A `size_type` parameter type in an `unordered_map` deduction guide
|
| 301 |
refers to the `size_type` member type of the type deduced by the
|