tmp/tmp884bmbjh/{from.md → to.md}
RENAMED
|
@@ -35,24 +35,25 @@ namespace std {
|
|
| 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
|
| 41 |
-
typedef typename
|
| 42 |
-
typedef
|
| 43 |
-
typedef
|
| 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 |
-
|
|
|
|
| 54 |
const hasher& hf = hasher(),
|
| 55 |
const key_equal& eql = key_equal(),
|
| 56 |
const allocator_type& a = allocator_type());
|
| 57 |
template <class InputIterator>
|
| 58 |
unordered_map(InputIterator f, InputIterator l,
|
|
@@ -68,10 +69,26 @@ namespace std {
|
|
| 68 |
unordered_map(initializer_list<value_type>,
|
| 69 |
size_type = see below,
|
| 70 |
const hasher& hf = hasher(),
|
| 71 |
const key_equal& eql = key_equal(),
|
| 72 |
const allocator_type& a = allocator_type());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
~unordered_map();
|
| 74 |
unordered_map& operator=(const unordered_map&);
|
| 75 |
unordered_map& operator=(unordered_map&&);
|
| 76 |
unordered_map& operator=(initializer_list<value_type>);
|
| 77 |
allocator_type get_allocator() const noexcept;
|
|
@@ -156,19 +173,20 @@ namespace std {
|
|
| 156 |
```
|
| 157 |
|
| 158 |
#### `unordered_map` constructors <a id="unord.map.cnstr">[[unord.map.cnstr]]</a>
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
-
|
|
|
|
| 162 |
const hasher& hf = hasher(),
|
| 163 |
const key_equal& eql = key_equal(),
|
| 164 |
const allocator_type& a = allocator_type());
|
| 165 |
```
|
| 166 |
|
| 167 |
*Effects:* Constructs an empty `unordered_map` using the specified hash
|
| 168 |
function, key equality function, and allocator, and using at least *`n`*
|
| 169 |
-
buckets.
|
| 170 |
*implementation-defined*. `max_load_factor()` returns 1.0.
|
| 171 |
|
| 172 |
*Complexity:* Constant.
|
| 173 |
|
| 174 |
``` cpp
|
|
@@ -193,13 +211,13 @@ buckets. If *`n`* is not provided, the number of buckets is
|
|
| 193 |
``` cpp
|
| 194 |
mapped_type& operator[](const key_type& k);
|
| 195 |
mapped_type& operator[](key_type&& k);
|
| 196 |
```
|
| 197 |
|
| 198 |
-
*Requires:* `mapped_type` shall be `
|
| 199 |
-
operator, `key_type` shall be `
|
| 200 |
-
operator, `key_type` shall be `MoveConstructible`.
|
| 201 |
|
| 202 |
*Effects:* If the `unordered_map` does not already contain an element
|
| 203 |
whose key is equivalent to *`k`*, the first operator inserts the value
|
| 204 |
`value_type(k, mapped_type())` and the second operator inserts the value
|
| 205 |
`value_type(std::move(k), mapped_type())`.
|
|
@@ -225,44 +243,25 @@ is present.
|
|
| 225 |
``` cpp
|
| 226 |
template <class P>
|
| 227 |
pair<iterator, bool> insert(P&& obj);
|
| 228 |
```
|
| 229 |
|
| 230 |
-
*
|
| 231 |
-
|
| 232 |
-
*Effects:* Inserts `obj` converted to `value_type` if and only if there
|
| 233 |
-
is no element in the container with key equivalent to the key of
|
| 234 |
-
`value_type(obj)`.
|
| 235 |
-
|
| 236 |
-
*Returns:* The `bool` component of the returned `pair` object indicates
|
| 237 |
-
whether the insertion took place and the iterator component points to
|
| 238 |
-
the element with key equivalent to the key of `value_type(obj)`.
|
| 239 |
-
|
| 240 |
-
*Complexity:* Average case 𝑂(1), worst case 𝑂(`size()`).
|
| 241 |
|
| 242 |
*Remarks:* This signature shall not participate in overload resolution
|
| 243 |
-
unless `P` is
|
| 244 |
|
| 245 |
``` cpp
|
| 246 |
template <class P>
|
| 247 |
iterator insert(const_iterator hint, P&& obj);
|
| 248 |
```
|
| 249 |
|
| 250 |
-
*
|
| 251 |
-
|
| 252 |
-
*Effects:* Inserts `obj` converted to `value_type` if and only if there
|
| 253 |
-
is no element in the container with key equivalent to the key of
|
| 254 |
-
`value_type(obj)`. The iterator `hint` is a hint pointing to where the
|
| 255 |
-
search should start.
|
| 256 |
-
|
| 257 |
-
*Returns:* An iterator that points to the element with key equivalent to
|
| 258 |
-
the key of `value_type(obj)`.
|
| 259 |
-
|
| 260 |
-
*Complexity:* Average case 𝑂(1), worst case 𝑂(`size()`).
|
| 261 |
|
| 262 |
*Remarks:* This signature shall not participate in overload resolution
|
| 263 |
-
unless `P` is
|
| 264 |
|
| 265 |
#### `unordered_map` swap <a id="unord.map.swap">[[unord.map.swap]]</a>
|
| 266 |
|
| 267 |
``` cpp
|
| 268 |
template <class Key, class T, class Hash, class Pred, class Alloc>
|
|
|
|
| 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());
|
| 58 |
template <class InputIterator>
|
| 59 |
unordered_map(InputIterator f, InputIterator l,
|
|
|
|
| 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) { }
|
| 76 |
+
unordered_map(size_type n, const hasher& hf, const allocator_type& a)
|
| 77 |
+
: unordered_map(n, hf, key_equal(), a) { }
|
| 78 |
+
template <class InputIterator>
|
| 79 |
+
unordered_map(InputIterator f, InputIterator l, size_type n, const allocator_type& a)
|
| 80 |
+
: unordered_map(f, l, n, hasher(), key_equal(), a) { }
|
| 81 |
+
template <class InputIterator>
|
| 82 |
+
unordered_map(InputIterator f, InputIterator l, size_type n, const hasher& hf,
|
| 83 |
+
const allocator_type& a)
|
| 84 |
+
: unordered_map(f, l, n, hf, key_equal(), a) { }
|
| 85 |
+
unordered_map(initializer_list<value_type> il, size_type n, const allocator_type& a)
|
| 86 |
+
: unordered_map(il, n, hasher(), key_equal(), a) { }
|
| 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;
|
|
|
|
| 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,
|
| 180 |
const hasher& hf = hasher(),
|
| 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
|
|
|
|
| 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())`.
|
|
|
|
| 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>
|