tmp/tmpsdq9za93/{from.md → to.md}
RENAMED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
A `multimap` is an associative container that supports equivalent keys
|
| 4 |
(possibly containing multiple copies of the same key value) and provides
|
| 5 |
for fast retrieval of values of another type `T` based on the keys. The
|
| 6 |
`multimap` class supports bidirectional iterators.
|
| 7 |
|
| 8 |
-
A `multimap`
|
| 9 |
-
reversible container
|
| 10 |
-
container
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
`
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace std {
|
| 22 |
template<class Key, class T, class Compare = less<Key>,
|
| 23 |
class Allocator = allocator<pair<const Key, T>>>
|
| 24 |
class multimap {
|
| 25 |
public:
|
| 26 |
-
// types
|
| 27 |
using key_type = Key;
|
| 28 |
using mapped_type = T;
|
| 29 |
using value_type = pair<const Key, T>;
|
| 30 |
using key_compare = Compare;
|
| 31 |
using allocator_type = Allocator;
|
|
@@ -78,11 +78,11 @@ namespace std {
|
|
| 78 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 79 |
is_nothrow_move_assignable_v<Compare>);
|
| 80 |
multimap& operator=(initializer_list<value_type>);
|
| 81 |
allocator_type get_allocator() const noexcept;
|
| 82 |
|
| 83 |
-
// iterators
|
| 84 |
iterator begin() noexcept;
|
| 85 |
const_iterator begin() const noexcept;
|
| 86 |
iterator end() noexcept;
|
| 87 |
const_iterator end() const noexcept;
|
| 88 |
|
|
@@ -94,12 +94,12 @@ namespace std {
|
|
| 94 |
const_iterator cbegin() const noexcept;
|
| 95 |
const_iterator cend() const noexcept;
|
| 96 |
const_reverse_iterator crbegin() const noexcept;
|
| 97 |
const_reverse_iterator crend() const noexcept;
|
| 98 |
|
| 99 |
-
// capacity
|
| 100 |
-
bool
|
| 101 |
size_type size() const noexcept;
|
| 102 |
size_type max_size() const noexcept;
|
| 103 |
|
| 104 |
// [multimap.modifiers], modifiers
|
| 105 |
template<class... Args> iterator emplace(Args&&... args);
|
|
@@ -135,23 +135,26 @@ namespace std {
|
|
| 135 |
template<class C2>
|
| 136 |
void merge(map<Key, T, C2, Allocator>& source);
|
| 137 |
template<class C2>
|
| 138 |
void merge(map<Key, T, C2, Allocator>&& source);
|
| 139 |
|
| 140 |
-
// observers
|
| 141 |
key_compare key_comp() const;
|
| 142 |
value_compare value_comp() const;
|
| 143 |
|
| 144 |
-
// map operations
|
| 145 |
iterator find(const key_type& x);
|
| 146 |
const_iterator find(const key_type& x) const;
|
| 147 |
template<class K> iterator find(const K& x);
|
| 148 |
template<class K> const_iterator find(const K& x) const;
|
| 149 |
|
| 150 |
size_type count(const key_type& x) const;
|
| 151 |
template<class K> size_type count(const K& x) const;
|
| 152 |
|
|
|
|
|
|
|
|
|
|
| 153 |
iterator lower_bound(const key_type& x);
|
| 154 |
const_iterator lower_bound(const key_type& x) const;
|
| 155 |
template<class K> iterator lower_bound(const K& x);
|
| 156 |
template<class K> const_iterator lower_bound(const K& x) const;
|
| 157 |
|
|
@@ -166,49 +169,31 @@ namespace std {
|
|
| 166 |
pair<iterator, iterator> equal_range(const K& x);
|
| 167 |
template<class K>
|
| 168 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 169 |
};
|
| 170 |
|
| 171 |
-
template<class InputIterator, class Compare = less<
|
| 172 |
-
class Allocator = allocator<
|
| 173 |
multimap(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
|
| 174 |
-
-> multimap<
|
|
|
|
| 175 |
|
| 176 |
template<class Key, class T, class Compare = less<Key>,
|
| 177 |
class Allocator = allocator<pair<const Key, T>>>
|
| 178 |
-
multimap(initializer_list<pair<
|
| 179 |
-> multimap<Key, T, Compare, Allocator>;
|
| 180 |
|
| 181 |
template<class InputIterator, class Allocator>
|
| 182 |
multimap(InputIterator, InputIterator, Allocator)
|
| 183 |
-
-> multimap<
|
| 184 |
-
less<
|
| 185 |
|
| 186 |
template<class Key, class T, class Allocator>
|
| 187 |
-
multimap(initializer_list<pair<
|
| 188 |
-> multimap<Key, T, less<Key>, Allocator>;
|
| 189 |
|
| 190 |
-
|
| 191 |
-
bool operator==(const multimap<Key, T, Compare, Allocator>& x,
|
| 192 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 193 |
-
template <class Key, class T, class Compare, class Allocator>
|
| 194 |
-
bool operator< (const multimap<Key, T, Compare, Allocator>& x,
|
| 195 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 196 |
-
template <class Key, class T, class Compare, class Allocator>
|
| 197 |
-
bool operator!=(const multimap<Key, T, Compare, Allocator>& x,
|
| 198 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 199 |
-
template <class Key, class T, class Compare, class Allocator>
|
| 200 |
-
bool operator> (const multimap<Key, T, Compare, Allocator>& x,
|
| 201 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 202 |
-
template <class Key, class T, class Compare, class Allocator>
|
| 203 |
-
bool operator>=(const multimap<Key, T, Compare, Allocator>& x,
|
| 204 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 205 |
-
template <class Key, class T, class Compare, class Allocator>
|
| 206 |
-
bool operator<=(const multimap<Key, T, Compare, Allocator>& x,
|
| 207 |
-
const multimap<Key, T, Compare, Allocator>& y);
|
| 208 |
-
|
| 209 |
-
// [multimap.special], specialized algorithms
|
| 210 |
template<class Key, class T, class Compare, class Allocator>
|
| 211 |
void swap(multimap<Key, T, Compare, Allocator>& x,
|
| 212 |
multimap<Key, T, Compare, Allocator>& y)
|
| 213 |
noexcept(noexcept(x.swap(y)));
|
| 214 |
}
|
|
|
|
| 1 |
+
#### Overview <a id="multimap.overview">[[multimap.overview]]</a>
|
| 2 |
|
| 3 |
A `multimap` is an associative container that supports equivalent keys
|
| 4 |
(possibly containing multiple copies of the same key value) and provides
|
| 5 |
for fast retrieval of values of another type `T` based on the keys. The
|
| 6 |
`multimap` class supports bidirectional iterators.
|
| 7 |
|
| 8 |
+
A `multimap` meets all of the requirements of a container and of a
|
| 9 |
+
reversible container [[container.requirements]], of an associative
|
| 10 |
+
container [[associative.reqmts]], and of an allocator-aware container (
|
| 11 |
+
[[container.alloc.req]]). A `multimap` also provides most operations
|
| 12 |
+
described in [[associative.reqmts]] for equal keys. This means that a
|
| 13 |
+
`multimap` supports the `a_eq` operations in [[associative.reqmts]] but
|
| 14 |
+
not the `a_uniq` operations. For a `multimap<Key,T>` the `key_type` is
|
| 15 |
+
`Key` and the `value_type` is `pair<const Key,T>`. Descriptions are
|
| 16 |
+
provided here only for operations on `multimap` that are not described
|
| 17 |
+
in one of those tables or for operations where there is additional
|
| 18 |
+
semantic information.
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace std {
|
| 22 |
template<class Key, class T, class Compare = less<Key>,
|
| 23 |
class Allocator = allocator<pair<const Key, T>>>
|
| 24 |
class multimap {
|
| 25 |
public:
|
| 26 |
+
// types
|
| 27 |
using key_type = Key;
|
| 28 |
using mapped_type = T;
|
| 29 |
using value_type = pair<const Key, T>;
|
| 30 |
using key_compare = Compare;
|
| 31 |
using allocator_type = Allocator;
|
|
|
|
| 78 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 79 |
is_nothrow_move_assignable_v<Compare>);
|
| 80 |
multimap& operator=(initializer_list<value_type>);
|
| 81 |
allocator_type get_allocator() const noexcept;
|
| 82 |
|
| 83 |
+
// iterators
|
| 84 |
iterator begin() noexcept;
|
| 85 |
const_iterator begin() const noexcept;
|
| 86 |
iterator end() noexcept;
|
| 87 |
const_iterator end() const noexcept;
|
| 88 |
|
|
|
|
| 94 |
const_iterator cbegin() const noexcept;
|
| 95 |
const_iterator cend() const noexcept;
|
| 96 |
const_reverse_iterator crbegin() const noexcept;
|
| 97 |
const_reverse_iterator crend() const noexcept;
|
| 98 |
|
| 99 |
+
// capacity
|
| 100 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 101 |
size_type size() const noexcept;
|
| 102 |
size_type max_size() const noexcept;
|
| 103 |
|
| 104 |
// [multimap.modifiers], modifiers
|
| 105 |
template<class... Args> iterator emplace(Args&&... args);
|
|
|
|
| 135 |
template<class C2>
|
| 136 |
void merge(map<Key, T, C2, Allocator>& source);
|
| 137 |
template<class C2>
|
| 138 |
void merge(map<Key, T, C2, Allocator>&& source);
|
| 139 |
|
| 140 |
+
// observers
|
| 141 |
key_compare key_comp() const;
|
| 142 |
value_compare value_comp() const;
|
| 143 |
|
| 144 |
+
// map operations
|
| 145 |
iterator find(const key_type& x);
|
| 146 |
const_iterator find(const key_type& x) const;
|
| 147 |
template<class K> iterator find(const K& x);
|
| 148 |
template<class K> const_iterator find(const K& x) const;
|
| 149 |
|
| 150 |
size_type count(const key_type& x) const;
|
| 151 |
template<class K> size_type count(const K& x) const;
|
| 152 |
|
| 153 |
+
bool contains(const key_type& x) const;
|
| 154 |
+
template<class K> bool contains(const K& x) const;
|
| 155 |
+
|
| 156 |
iterator lower_bound(const key_type& x);
|
| 157 |
const_iterator lower_bound(const key_type& x) const;
|
| 158 |
template<class K> iterator lower_bound(const K& x);
|
| 159 |
template<class K> const_iterator lower_bound(const K& x) const;
|
| 160 |
|
|
|
|
| 169 |
pair<iterator, iterator> equal_range(const K& x);
|
| 170 |
template<class K>
|
| 171 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 172 |
};
|
| 173 |
|
| 174 |
+
template<class InputIterator, class Compare = less<iter-key-type<InputIterator>>,
|
| 175 |
+
class Allocator = allocator<iter-to-alloc-type<InputIterator>>>
|
| 176 |
multimap(InputIterator, InputIterator, Compare = Compare(), Allocator = Allocator())
|
| 177 |
+
-> multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 178 |
+
Compare, Allocator>;
|
| 179 |
|
| 180 |
template<class Key, class T, class Compare = less<Key>,
|
| 181 |
class Allocator = allocator<pair<const Key, T>>>
|
| 182 |
+
multimap(initializer_list<pair<Key, T>>, Compare = Compare(), Allocator = Allocator())
|
| 183 |
-> multimap<Key, T, Compare, Allocator>;
|
| 184 |
|
| 185 |
template<class InputIterator, class Allocator>
|
| 186 |
multimap(InputIterator, InputIterator, Allocator)
|
| 187 |
+
-> multimap<iter-key-type<InputIterator>, iter-mapped-type<InputIterator>,
|
| 188 |
+
less<iter-key-type<InputIterator>>, Allocator>;
|
| 189 |
|
| 190 |
template<class Key, class T, class Allocator>
|
| 191 |
+
multimap(initializer_list<pair<Key, T>>, Allocator)
|
| 192 |
-> multimap<Key, T, less<Key>, Allocator>;
|
| 193 |
|
| 194 |
+
// swap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
template<class Key, class T, class Compare, class Allocator>
|
| 196 |
void swap(multimap<Key, T, Compare, Allocator>& x,
|
| 197 |
multimap<Key, T, Compare, Allocator>& y)
|
| 198 |
noexcept(noexcept(x.swap(y)));
|
| 199 |
}
|