tmp/tmpwfd37dy_/{from.md → to.md}
RENAMED
|
@@ -1,36 +1,36 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
An `unordered_multimap` is an unordered associative container that
|
| 4 |
supports equivalent keys (an instance of `unordered_multimap` may
|
| 5 |
contain multiple copies of each key value) and that associates values of
|
| 6 |
another type `mapped_type` with the keys. The `unordered_multimap` class
|
| 7 |
supports forward iterators.
|
| 8 |
|
| 9 |
-
An `unordered_multimap`
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
`
|
| 16 |
-
`
|
| 17 |
|
| 18 |
-
|
| 19 |
-
not described in one of the requirement
|
| 20 |
-
additional semantic information.
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
namespace std {
|
| 24 |
template<class Key,
|
| 25 |
class T,
|
| 26 |
class Hash = hash<Key>,
|
| 27 |
class Pred = equal_to<Key>,
|
| 28 |
class Allocator = allocator<pair<const Key, T>>>
|
| 29 |
class unordered_multimap {
|
| 30 |
public:
|
| 31 |
-
// types
|
| 32 |
using key_type = Key;
|
| 33 |
using mapped_type = T;
|
| 34 |
using value_type = pair<const Key, T>;
|
| 35 |
using hasher = Hash;
|
| 36 |
using key_equal = Pred;
|
|
@@ -93,20 +93,20 @@ namespace std {
|
|
| 93 |
is_nothrow_move_assignable_v<Hash> &&
|
| 94 |
is_nothrow_move_assignable_v<Pred>);
|
| 95 |
unordered_multimap& operator=(initializer_list<value_type>);
|
| 96 |
allocator_type get_allocator() const noexcept;
|
| 97 |
|
| 98 |
-
// iterators
|
| 99 |
iterator begin() noexcept;
|
| 100 |
const_iterator begin() const noexcept;
|
| 101 |
iterator end() noexcept;
|
| 102 |
const_iterator end() const noexcept;
|
| 103 |
const_iterator cbegin() const noexcept;
|
| 104 |
const_iterator cend() const noexcept;
|
| 105 |
|
| 106 |
-
// capacity
|
| 107 |
-
bool
|
| 108 |
size_type size() const noexcept;
|
| 109 |
size_type max_size() const noexcept;
|
| 110 |
|
| 111 |
// [unord.multimap.modifiers], modifiers
|
| 112 |
template<class... Args> iterator emplace(Args&&... args);
|
|
@@ -142,22 +142,35 @@ namespace std {
|
|
| 142 |
template<class H2, class P2>
|
| 143 |
void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
|
| 144 |
template<class H2, class P2>
|
| 145 |
void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
|
| 146 |
|
| 147 |
-
// observers
|
| 148 |
hasher hash_function() const;
|
| 149 |
key_equal key_eq() const;
|
| 150 |
|
| 151 |
-
// map operations
|
| 152 |
iterator find(const key_type& k);
|
| 153 |
const_iterator find(const key_type& k) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
size_type count(const key_type& k) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
pair<iterator, iterator> equal_range(const key_type& k);
|
| 156 |
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
|
| 158 |
-
// bucket interface
|
| 159 |
size_type bucket_count() const noexcept;
|
| 160 |
size_type max_bucket_count() const noexcept;
|
| 161 |
size_type bucket_size(size_type n) const;
|
| 162 |
size_type bucket(const key_type& k) const;
|
| 163 |
local_iterator begin(size_type n);
|
|
@@ -174,66 +187,59 @@ namespace std {
|
|
| 174 |
void rehash(size_type n);
|
| 175 |
void reserve(size_type n);
|
| 176 |
};
|
| 177 |
|
| 178 |
template<class InputIterator,
|
| 179 |
-
class Hash = hash<
|
| 180 |
-
class Pred = equal_to<
|
| 181 |
-
class Allocator = allocator<
|
| 182 |
unordered_multimap(InputIterator, InputIterator,
|
| 183 |
typename see below::size_type = see below,
|
| 184 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 185 |
-
-> unordered_multimap<
|
| 186 |
-
Allocator>;
|
| 187 |
|
| 188 |
template<class Key, class T, class Hash = hash<Key>,
|
| 189 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 190 |
-
unordered_multimap(initializer_list<pair<
|
| 191 |
typename see below::size_type = see below,
|
| 192 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 193 |
-> unordered_multimap<Key, T, Hash, Pred, Allocator>;
|
| 194 |
|
| 195 |
template<class InputIterator, class Allocator>
|
| 196 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator)
|
| 197 |
-
-> unordered_multimap<
|
| 198 |
-
hash<
|
| 199 |
-
equal_to<
|
| 200 |
|
| 201 |
template<class InputIterator, class Allocator>
|
| 202 |
unordered_multimap(InputIterator, InputIterator, Allocator)
|
| 203 |
-
-> unordered_multimap<
|
| 204 |
-
hash<
|
| 205 |
-
equal_to<
|
| 206 |
|
| 207 |
template<class InputIterator, class Hash, class Allocator>
|
| 208 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash,
|
| 209 |
Allocator)
|
| 210 |
-
-> unordered_multimap<
|
| 211 |
-
equal_to<
|
| 212 |
|
| 213 |
-
template<class Key, class T,
|
| 214 |
-
unordered_multimap(initializer_list<pair<
|
| 215 |
Allocator)
|
| 216 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 217 |
|
| 218 |
-
template<class Key, class T,
|
| 219 |
-
unordered_multimap(initializer_list<pair<
|
| 220 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 221 |
|
| 222 |
template<class Key, class T, class Hash, class Allocator>
|
| 223 |
-
unordered_multimap(initializer_list<pair<
|
| 224 |
Hash, Allocator)
|
| 225 |
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;
|
| 226 |
|
| 227 |
-
|
| 228 |
-
bool operator==(const unordered_multimap<Key, T, Hash, Pred, Alloc>& a,
|
| 229 |
-
const unordered_multimap<Key, T, Hash, Pred, Alloc>& b);
|
| 230 |
-
template <class Key, class T, class Hash, class Pred, class Alloc>
|
| 231 |
-
bool operator!=(const unordered_multimap<Key, T, Hash, Pred, Alloc>& a,
|
| 232 |
-
const unordered_multimap<Key, T, Hash, Pred, Alloc>& b);
|
| 233 |
-
|
| 234 |
-
// [unord.multimap.swap], swap
|
| 235 |
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 236 |
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
| 237 |
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
| 238 |
noexcept(noexcept(x.swap(y)));
|
| 239 |
}
|
|
|
|
| 1 |
+
#### Overview <a id="unord.multimap.overview">[[unord.multimap.overview]]</a>
|
| 2 |
|
| 3 |
An `unordered_multimap` is an unordered associative container that
|
| 4 |
supports equivalent keys (an instance of `unordered_multimap` may
|
| 5 |
contain multiple copies of each key value) and that associates values of
|
| 6 |
another type `mapped_type` with the keys. The `unordered_multimap` class
|
| 7 |
supports forward iterators.
|
| 8 |
|
| 9 |
+
An `unordered_multimap` meets all of the requirements of a container, of
|
| 10 |
+
an unordered associative container, and of an allocator-aware container
|
| 11 |
+
([[container.alloc.req]]). It provides the operations described in the
|
| 12 |
+
preceding requirements table for equivalent keys; that is, an
|
| 13 |
+
`unordered_multimap` supports the `a_eq` operations in that table, not
|
| 14 |
+
the `a_uniq` operations. For an `unordered_multimap<Key, T>` the
|
| 15 |
+
`key type` is `Key`, the mapped type is `T`, and the value type is
|
| 16 |
+
`pair<const Key, T>`.
|
| 17 |
|
| 18 |
+
Subclause [[unord.multimap]] only describes operations on
|
| 19 |
+
`unordered_multimap` that are not described in one of the requirement
|
| 20 |
+
tables, or for which there is additional semantic information.
|
| 21 |
|
| 22 |
``` cpp
|
| 23 |
namespace std {
|
| 24 |
template<class Key,
|
| 25 |
class T,
|
| 26 |
class Hash = hash<Key>,
|
| 27 |
class Pred = equal_to<Key>,
|
| 28 |
class Allocator = allocator<pair<const Key, T>>>
|
| 29 |
class unordered_multimap {
|
| 30 |
public:
|
| 31 |
+
// types
|
| 32 |
using key_type = Key;
|
| 33 |
using mapped_type = T;
|
| 34 |
using value_type = pair<const Key, T>;
|
| 35 |
using hasher = Hash;
|
| 36 |
using key_equal = Pred;
|
|
|
|
| 93 |
is_nothrow_move_assignable_v<Hash> &&
|
| 94 |
is_nothrow_move_assignable_v<Pred>);
|
| 95 |
unordered_multimap& operator=(initializer_list<value_type>);
|
| 96 |
allocator_type get_allocator() const noexcept;
|
| 97 |
|
| 98 |
+
// iterators
|
| 99 |
iterator begin() noexcept;
|
| 100 |
const_iterator begin() const noexcept;
|
| 101 |
iterator end() noexcept;
|
| 102 |
const_iterator end() const noexcept;
|
| 103 |
const_iterator cbegin() const noexcept;
|
| 104 |
const_iterator cend() const noexcept;
|
| 105 |
|
| 106 |
+
// capacity
|
| 107 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 108 |
size_type size() const noexcept;
|
| 109 |
size_type max_size() const noexcept;
|
| 110 |
|
| 111 |
// [unord.multimap.modifiers], modifiers
|
| 112 |
template<class... Args> iterator emplace(Args&&... args);
|
|
|
|
| 142 |
template<class H2, class P2>
|
| 143 |
void merge(unordered_map<Key, T, H2, P2, Allocator>& source);
|
| 144 |
template<class H2, class P2>
|
| 145 |
void merge(unordered_map<Key, T, H2, P2, Allocator>&& source);
|
| 146 |
|
| 147 |
+
// observers
|
| 148 |
hasher hash_function() const;
|
| 149 |
key_equal key_eq() const;
|
| 150 |
|
| 151 |
+
// map operations
|
| 152 |
iterator find(const key_type& k);
|
| 153 |
const_iterator find(const key_type& k) const;
|
| 154 |
+
template<class K>
|
| 155 |
+
iterator find(const K& k);
|
| 156 |
+
template<class K>
|
| 157 |
+
const_iterator find(const K& k) const;
|
| 158 |
size_type count(const key_type& k) const;
|
| 159 |
+
template<class K>
|
| 160 |
+
size_type count(const K& k) const;
|
| 161 |
+
bool contains(const key_type& k) const;
|
| 162 |
+
template<class K>
|
| 163 |
+
bool contains(const K& k) const;
|
| 164 |
pair<iterator, iterator> equal_range(const key_type& k);
|
| 165 |
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
| 166 |
+
template<class K>
|
| 167 |
+
pair<iterator, iterator> equal_range(const K& k);
|
| 168 |
+
template<class K>
|
| 169 |
+
pair<const_iterator, const_iterator> equal_range(const K& k) const;
|
| 170 |
|
| 171 |
+
// bucket interface
|
| 172 |
size_type bucket_count() const noexcept;
|
| 173 |
size_type max_bucket_count() const noexcept;
|
| 174 |
size_type bucket_size(size_type n) const;
|
| 175 |
size_type bucket(const key_type& k) const;
|
| 176 |
local_iterator begin(size_type n);
|
|
|
|
| 187 |
void rehash(size_type n);
|
| 188 |
void reserve(size_type n);
|
| 189 |
};
|
| 190 |
|
| 191 |
template<class InputIterator,
|
| 192 |
+
class Hash = hash<iter-key-type<InputIterator>>,
|
| 193 |
+
class Pred = equal_to<iter-key-type<InputIterator>>,
|
| 194 |
+
class Allocator = allocator<iter-to-alloc-type<InputIterator>>>
|
| 195 |
unordered_multimap(InputIterator, InputIterator,
|
| 196 |
typename see below::size_type = see below,
|
| 197 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 198 |
+
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 199 |
+
Hash, Pred, Allocator>;
|
| 200 |
|
| 201 |
template<class Key, class T, class Hash = hash<Key>,
|
| 202 |
class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>>
|
| 203 |
+
unordered_multimap(initializer_list<pair<Key, T>>,
|
| 204 |
typename see below::size_type = see below,
|
| 205 |
Hash = Hash(), Pred = Pred(), Allocator = Allocator())
|
| 206 |
-> unordered_multimap<Key, T, Hash, Pred, Allocator>;
|
| 207 |
|
| 208 |
template<class InputIterator, class Allocator>
|
| 209 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Allocator)
|
| 210 |
+
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 211 |
+
hash<iter-key-type<InputIterator>>,
|
| 212 |
+
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 213 |
|
| 214 |
template<class InputIterator, class Allocator>
|
| 215 |
unordered_multimap(InputIterator, InputIterator, Allocator)
|
| 216 |
+
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 217 |
+
hash<iter-key-type<InputIterator>>,
|
| 218 |
+
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 219 |
|
| 220 |
template<class InputIterator, class Hash, class Allocator>
|
| 221 |
unordered_multimap(InputIterator, InputIterator, typename see below::size_type, Hash,
|
| 222 |
Allocator)
|
| 223 |
+
-> unordered_multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>, Hash,
|
| 224 |
+
equal_to<iter-key-type<InputIterator>>, Allocator>;
|
| 225 |
|
| 226 |
+
template<class Key, class T, class Allocator>
|
| 227 |
+
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 228 |
Allocator)
|
| 229 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 230 |
|
| 231 |
+
template<class Key, class T, class Allocator>
|
| 232 |
+
unordered_multimap(initializer_list<pair<Key, T>>, Allocator)
|
| 233 |
-> unordered_multimap<Key, T, hash<Key>, equal_to<Key>, Allocator>;
|
| 234 |
|
| 235 |
template<class Key, class T, class Hash, class Allocator>
|
| 236 |
+
unordered_multimap(initializer_list<pair<Key, T>>, typename see below::size_type,
|
| 237 |
Hash, Allocator)
|
| 238 |
-> unordered_multimap<Key, T, Hash, equal_to<Key>, Allocator>;
|
| 239 |
|
| 240 |
+
// swap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
template<class Key, class T, class Hash, class Pred, class Alloc>
|
| 242 |
void swap(unordered_multimap<Key, T, Hash, Pred, Alloc>& x,
|
| 243 |
unordered_multimap<Key, T, Hash, Pred, Alloc>& y)
|
| 244 |
noexcept(noexcept(x.swap(y)));
|
| 245 |
}
|