tmp/tmplss4nwe2/{from.md → to.md}
RENAMED
|
@@ -1,31 +1,31 @@
|
|
| 1 |
-
####
|
| 2 |
|
| 3 |
A `multiset` is an associative container that supports equivalent keys
|
| 4 |
(possibly contains multiple copies of the same key value) and provides
|
| 5 |
for fast retrieval of the keys themselves. The `multiset` class supports
|
| 6 |
bidirectional iterators.
|
| 7 |
|
| 8 |
-
A `multiset`
|
| 9 |
-
reversible container
|
| 10 |
-
container
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
`
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace std {
|
| 22 |
template<class Key, class Compare = less<Key>,
|
| 23 |
class Allocator = allocator<Key>>
|
| 24 |
class multiset {
|
| 25 |
public:
|
| 26 |
-
// types
|
| 27 |
using key_type = Key;
|
| 28 |
using key_compare = Compare;
|
| 29 |
using value_type = Key;
|
| 30 |
using value_compare = Compare;
|
| 31 |
using allocator_type = Allocator;
|
|
@@ -65,11 +65,11 @@ namespace std {
|
|
| 65 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 66 |
is_nothrow_move_assignable_v<Compare>);
|
| 67 |
multiset& operator=(initializer_list<value_type>);
|
| 68 |
allocator_type get_allocator() const noexcept;
|
| 69 |
|
| 70 |
-
// iterators
|
| 71 |
iterator begin() noexcept;
|
| 72 |
const_iterator begin() const noexcept;
|
| 73 |
iterator end() noexcept;
|
| 74 |
const_iterator end() const noexcept;
|
| 75 |
|
|
@@ -81,16 +81,16 @@ namespace std {
|
|
| 81 |
const_iterator cbegin() const noexcept;
|
| 82 |
const_iterator cend() const noexcept;
|
| 83 |
const_reverse_iterator crbegin() const noexcept;
|
| 84 |
const_reverse_iterator crend() const noexcept;
|
| 85 |
|
| 86 |
-
// capacity
|
| 87 |
-
bool
|
| 88 |
size_type size() const noexcept;
|
| 89 |
size_type max_size() const noexcept;
|
| 90 |
|
| 91 |
-
// modifiers
|
| 92 |
template<class... Args> iterator emplace(Args&&... args);
|
| 93 |
template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
|
| 94 |
iterator insert(const value_type& x);
|
| 95 |
iterator insert(value_type&& x);
|
| 96 |
iterator insert(const_iterator position, const value_type& x);
|
|
@@ -120,23 +120,26 @@ namespace std {
|
|
| 120 |
template<class C2>
|
| 121 |
void merge(set<Key, C2, Allocator>& source);
|
| 122 |
template<class C2>
|
| 123 |
void merge(set<Key, C2, Allocator>&& source);
|
| 124 |
|
| 125 |
-
// observers
|
| 126 |
key_compare key_comp() const;
|
| 127 |
value_compare value_comp() const;
|
| 128 |
|
| 129 |
-
// set operations
|
| 130 |
iterator find(const key_type& x);
|
| 131 |
const_iterator find(const key_type& x) const;
|
| 132 |
template<class K> iterator find(const K& x);
|
| 133 |
template<class K> const_iterator find(const K& x) const;
|
| 134 |
|
| 135 |
size_type count(const key_type& x) const;
|
| 136 |
template<class K> size_type count(const K& x) const;
|
| 137 |
|
|
|
|
|
|
|
|
|
|
| 138 |
iterator lower_bound(const key_type& x);
|
| 139 |
const_iterator lower_bound(const key_type& x) const;
|
| 140 |
template<class K> iterator lower_bound(const K& x);
|
| 141 |
template<class K> const_iterator lower_bound(const K& x) const;
|
| 142 |
|
|
@@ -152,48 +155,29 @@ namespace std {
|
|
| 152 |
template<class K>
|
| 153 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 154 |
};
|
| 155 |
|
| 156 |
template<class InputIterator,
|
| 157 |
-
class Compare = less<
|
| 158 |
-
class Allocator = allocator<
|
| 159 |
multiset(InputIterator, InputIterator,
|
| 160 |
Compare = Compare(), Allocator = Allocator())
|
| 161 |
-
-> multiset<
|
| 162 |
|
| 163 |
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
|
| 164 |
multiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
|
| 165 |
-> multiset<Key, Compare, Allocator>;
|
| 166 |
|
| 167 |
template<class InputIterator, class Allocator>
|
| 168 |
multiset(InputIterator, InputIterator, Allocator)
|
| 169 |
-
-> multiset<
|
| 170 |
-
less<
|
| 171 |
|
| 172 |
template<class Key, class Allocator>
|
| 173 |
multiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>;
|
| 174 |
|
| 175 |
-
|
| 176 |
-
bool operator==(const multiset<Key, Compare, Allocator>& x,
|
| 177 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 178 |
-
template <class Key, class Compare, class Allocator>
|
| 179 |
-
bool operator< (const multiset<Key, Compare, Allocator>& x,
|
| 180 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 181 |
-
template <class Key, class Compare, class Allocator>
|
| 182 |
-
bool operator!=(const multiset<Key, Compare, Allocator>& x,
|
| 183 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 184 |
-
template <class Key, class Compare, class Allocator>
|
| 185 |
-
bool operator> (const multiset<Key, Compare, Allocator>& x,
|
| 186 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 187 |
-
template <class Key, class Compare, class Allocator>
|
| 188 |
-
bool operator>=(const multiset<Key, Compare, Allocator>& x,
|
| 189 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 190 |
-
template <class Key, class Compare, class Allocator>
|
| 191 |
-
bool operator<=(const multiset<Key, Compare, Allocator>& x,
|
| 192 |
-
const multiset<Key, Compare, Allocator>& y);
|
| 193 |
-
|
| 194 |
-
// [multiset.special], specialized algorithms
|
| 195 |
template<class Key, class Compare, class Allocator>
|
| 196 |
void swap(multiset<Key, Compare, Allocator>& x,
|
| 197 |
multiset<Key, Compare, Allocator>& y)
|
| 198 |
noexcept(noexcept(x.swap(y)));
|
| 199 |
}
|
|
|
|
| 1 |
+
#### Overview <a id="multiset.overview">[[multiset.overview]]</a>
|
| 2 |
|
| 3 |
A `multiset` is an associative container that supports equivalent keys
|
| 4 |
(possibly contains multiple copies of the same key value) and provides
|
| 5 |
for fast retrieval of the keys themselves. The `multiset` class supports
|
| 6 |
bidirectional iterators.
|
| 7 |
|
| 8 |
+
A `multiset` meets all of the requirements of a container, of a
|
| 9 |
+
reversible container [[container.requirements]], of an associative
|
| 10 |
+
container [[associative.reqmts]], and of an allocator-aware container (
|
| 11 |
+
[[container.alloc.req]]). `multiset` also provides most operations
|
| 12 |
+
described in [[associative.reqmts]] for duplicate keys. This means that
|
| 13 |
+
a `multiset` supports the `a_eq` operations in [[associative.reqmts]]
|
| 14 |
+
but not the `a_uniq` operations. For a `multiset<Key>` both the
|
| 15 |
+
`key_type` and `value_type` are `Key`. Descriptions are provided here
|
| 16 |
+
only for operations on `multiset` that are not described in one of these
|
| 17 |
+
tables and for operations where there is additional semantic
|
| 18 |
+
information.
|
| 19 |
|
| 20 |
``` cpp
|
| 21 |
namespace std {
|
| 22 |
template<class Key, class Compare = less<Key>,
|
| 23 |
class Allocator = allocator<Key>>
|
| 24 |
class multiset {
|
| 25 |
public:
|
| 26 |
+
// types
|
| 27 |
using key_type = Key;
|
| 28 |
using key_compare = Compare;
|
| 29 |
using value_type = Key;
|
| 30 |
using value_compare = Compare;
|
| 31 |
using allocator_type = Allocator;
|
|
|
|
| 65 |
noexcept(allocator_traits<Allocator>::is_always_equal::value &&
|
| 66 |
is_nothrow_move_assignable_v<Compare>);
|
| 67 |
multiset& operator=(initializer_list<value_type>);
|
| 68 |
allocator_type get_allocator() const noexcept;
|
| 69 |
|
| 70 |
+
// iterators
|
| 71 |
iterator begin() noexcept;
|
| 72 |
const_iterator begin() const noexcept;
|
| 73 |
iterator end() noexcept;
|
| 74 |
const_iterator end() const noexcept;
|
| 75 |
|
|
|
|
| 81 |
const_iterator cbegin() const noexcept;
|
| 82 |
const_iterator cend() const noexcept;
|
| 83 |
const_reverse_iterator crbegin() const noexcept;
|
| 84 |
const_reverse_iterator crend() const noexcept;
|
| 85 |
|
| 86 |
+
// capacity
|
| 87 |
+
[[nodiscard]] bool empty() const noexcept;
|
| 88 |
size_type size() const noexcept;
|
| 89 |
size_type max_size() const noexcept;
|
| 90 |
|
| 91 |
+
// modifiers
|
| 92 |
template<class... Args> iterator emplace(Args&&... args);
|
| 93 |
template<class... Args> iterator emplace_hint(const_iterator position, Args&&... args);
|
| 94 |
iterator insert(const value_type& x);
|
| 95 |
iterator insert(value_type&& x);
|
| 96 |
iterator insert(const_iterator position, const value_type& x);
|
|
|
|
| 120 |
template<class C2>
|
| 121 |
void merge(set<Key, C2, Allocator>& source);
|
| 122 |
template<class C2>
|
| 123 |
void merge(set<Key, C2, Allocator>&& source);
|
| 124 |
|
| 125 |
+
// observers
|
| 126 |
key_compare key_comp() const;
|
| 127 |
value_compare value_comp() const;
|
| 128 |
|
| 129 |
+
// set operations
|
| 130 |
iterator find(const key_type& x);
|
| 131 |
const_iterator find(const key_type& x) const;
|
| 132 |
template<class K> iterator find(const K& x);
|
| 133 |
template<class K> const_iterator find(const K& x) const;
|
| 134 |
|
| 135 |
size_type count(const key_type& x) const;
|
| 136 |
template<class K> size_type count(const K& x) const;
|
| 137 |
|
| 138 |
+
bool contains(const key_type& x) const;
|
| 139 |
+
template<class K> bool contains(const K& x) const;
|
| 140 |
+
|
| 141 |
iterator lower_bound(const key_type& x);
|
| 142 |
const_iterator lower_bound(const key_type& x) const;
|
| 143 |
template<class K> iterator lower_bound(const K& x);
|
| 144 |
template<class K> const_iterator lower_bound(const K& x) const;
|
| 145 |
|
|
|
|
| 155 |
template<class K>
|
| 156 |
pair<const_iterator, const_iterator> equal_range(const K& x) const;
|
| 157 |
};
|
| 158 |
|
| 159 |
template<class InputIterator,
|
| 160 |
+
class Compare = less<iter-value-type<InputIterator>>,
|
| 161 |
+
class Allocator = allocator<iter-value-type<InputIterator>>>
|
| 162 |
multiset(InputIterator, InputIterator,
|
| 163 |
Compare = Compare(), Allocator = Allocator())
|
| 164 |
+
-> multiset<iter-value-type<InputIterator>, Compare, Allocator>;
|
| 165 |
|
| 166 |
template<class Key, class Compare = less<Key>, class Allocator = allocator<Key>>
|
| 167 |
multiset(initializer_list<Key>, Compare = Compare(), Allocator = Allocator())
|
| 168 |
-> multiset<Key, Compare, Allocator>;
|
| 169 |
|
| 170 |
template<class InputIterator, class Allocator>
|
| 171 |
multiset(InputIterator, InputIterator, Allocator)
|
| 172 |
+
-> multiset<iter-value-type<InputIterator>,
|
| 173 |
+
less<iter-value-type<InputIterator>>, Allocator>;
|
| 174 |
|
| 175 |
template<class Key, class Allocator>
|
| 176 |
multiset(initializer_list<Key>, Allocator) -> multiset<Key, less<Key>, Allocator>;
|
| 177 |
|
| 178 |
+
// swap
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
template<class Key, class Compare, class Allocator>
|
| 180 |
void swap(multiset<Key, Compare, Allocator>& x,
|
| 181 |
multiset<Key, Compare, Allocator>& y)
|
| 182 |
noexcept(noexcept(x.swap(y)));
|
| 183 |
}
|