56 #ifndef _STL_MULTISET_H
57 #define _STL_MULTISET_H 1
60 #if __cplusplus >= 201103L
61 #include <initializer_list>
64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
90 template <
typename _Key,
typename _Compare = std::less<_Key>,
91 typename _Alloc = std::allocator<_Key> >
95 typedef typename _Alloc::value_type _Alloc_value_type;
96 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
97 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
98 _BinaryFunctionConcept)
99 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
103 typedef _Key key_type;
104 typedef _Key value_type;
105 typedef _Compare key_compare;
106 typedef _Compare value_compare;
107 typedef _Alloc allocator_type;
111 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
113 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
114 key_compare, _Key_alloc_type> _Rep_type;
119 typedef typename _Key_alloc_type::pointer pointer;
120 typedef typename _Key_alloc_type::const_pointer const_pointer;
121 typedef typename _Key_alloc_type::reference reference;
122 typedef typename _Key_alloc_type::const_reference const_reference;
126 typedef typename _Rep_type::const_iterator iterator;
127 typedef typename _Rep_type::const_iterator const_iterator;
130 typedef typename _Rep_type::size_type size_type;
131 typedef typename _Rep_type::difference_type difference_type;
147 const allocator_type& __a = allocator_type())
148 : _M_t(__comp, _Key_alloc_type(__a)) { }
159 template<
typename _InputIterator>
160 multiset(_InputIterator __first, _InputIterator __last)
162 { _M_t._M_insert_equal(__first, __last); }
175 template<
typename _InputIterator>
176 multiset(_InputIterator __first, _InputIterator __last,
177 const _Compare& __comp,
178 const allocator_type& __a = allocator_type())
179 : _M_t(__comp, _Key_alloc_type(__a))
180 { _M_t._M_insert_equal(__first, __last); }
192 #if __cplusplus >= 201103L
201 noexcept(is_nothrow_copy_constructible<_Compare>::value)
202 : _M_t(
std::
move(__x._M_t)) { }
215 const _Compare& __comp = _Compare(),
216 const allocator_type& __a = allocator_type())
217 : _M_t(__comp, _Key_alloc_type(__a))
218 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
235 #if __cplusplus >= 201103L
269 this->
insert(__l.begin(), __l.end());
279 {
return _M_t.key_comp(); }
283 {
return _M_t.key_comp(); }
287 {
return allocator_type(_M_t.get_allocator()); }
296 {
return _M_t.begin(); }
304 end() const _GLIBCXX_NOEXCEPT
305 {
return _M_t.end(); }
314 {
return _M_t.rbegin(); }
323 {
return _M_t.rend(); }
325 #if __cplusplus >= 201103L
333 {
return _M_t.begin(); }
342 {
return _M_t.end(); }
351 {
return _M_t.rbegin(); }
360 {
return _M_t.rend(); }
366 {
return _M_t.empty(); }
371 {
return _M_t.size(); }
376 {
return _M_t.max_size(); }
391 { _M_t.swap(__x._M_t); }
394 #if __cplusplus >= 201103L
407 template<
typename... _Args>
410 {
return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); }
433 template<
typename... _Args>
437 return _M_t._M_emplace_hint_equal(__pos,
438 std::forward<_Args>(__args)...);
455 {
return _M_t._M_insert_equal(__x); }
457 #if __cplusplus >= 201103L
460 {
return _M_t._M_insert_equal(
std::move(__x)); }
484 insert(const_iterator __position,
const value_type& __x)
485 {
return _M_t._M_insert_equal_(__position, __x); }
487 #if __cplusplus >= 201103L
489 insert(const_iterator __position, value_type&& __x)
490 {
return _M_t._M_insert_equal_(__position,
std::move(__x)); }
501 template<
typename _InputIterator>
503 insert(_InputIterator __first, _InputIterator __last)
504 { _M_t._M_insert_equal(__first, __last); }
506 #if __cplusplus >= 201103L
516 { this->
insert(__l.begin(), __l.end()); }
519 #if __cplusplus >= 201103L
535 _GLIBCXX_ABI_TAG_CXX11
538 {
return _M_t.erase(__position); }
551 erase(iterator __position)
552 { _M_t.erase(__position); }
568 {
return _M_t.erase(__x); }
570 #if __cplusplus >= 201103L
587 _GLIBCXX_ABI_TAG_CXX11
589 erase(const_iterator __first, const_iterator __last)
590 {
return _M_t.erase(__first, __last); }
605 erase(iterator __first, iterator __last)
606 { _M_t.erase(__first, __last); }
628 {
return _M_t.count(__x); }
646 {
return _M_t.find(__x); }
649 find(
const key_type& __x)
const
650 {
return _M_t.find(__x); }
667 {
return _M_t.lower_bound(__x); }
671 {
return _M_t.lower_bound(__x); }
683 {
return _M_t.upper_bound(__x); }
687 {
return _M_t.upper_bound(__x); }
708 {
return _M_t.equal_range(__x); }
712 {
return _M_t.equal_range(__x); }
715 template<
typename _K1,
typename _C1,
typename _A1>
720 template<
typename _K1,
typename _C1,
typename _A1>
722 operator< (const multiset<_K1, _C1, _A1>&,
737 template<
typename _Key,
typename _Compare,
typename _Alloc>
741 {
return __x._M_t == __y._M_t; }
754 template<
typename _Key,
typename _Compare,
typename _Alloc>
756 operator<(const multiset<_Key, _Compare, _Alloc>& __x,
758 {
return __x._M_t < __y._M_t; }
761 template<
typename _Key,
typename _Compare,
typename _Alloc>
765 {
return !(__x == __y); }
768 template<
typename _Key,
typename _Compare,
typename _Alloc>
772 {
return __y < __x; }
775 template<
typename _Key,
typename _Compare,
typename _Alloc>
777 operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
779 {
return !(__y < __x); }
782 template<
typename _Key,
typename _Compare,
typename _Alloc>
786 {
return !(__x < __y); }
789 template<
typename _Key,
typename _Compare,
typename _Alloc>
795 _GLIBCXX_END_NAMESPACE_CONTAINER
iterator find(const key_type &__x)
Tries to locate an element in a set.
multiset(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multiset from an initializer_list.
iterator insert(const_iterator __position, const value_type &__x)
Inserts an element into the multiset.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the multiset.
reverse_iterator crbegin() const noexcept
value_compare value_comp() const
Returns the comparison object.
iterator insert(const value_type &__x)
Inserts an element into the multiset.
size_type size() const noexcept
Returns the size of the set.
iterator emplace(_Args &&...__args)
Builds and inserts an element into the multiset.
multiset & operator=(const multiset &__x)
Multiset assignment operator.
iterator begin() const noexcept
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
void swap(multiset &__x)
Swaps data with another multiset.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a multiset.
multiset(const multiset &__x)
Multiset copy constructor.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
multiset(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multiset with no elements.
key_compare key_comp() const
Returns the comparison object.
multiset & operator=(initializer_list< value_type > __l)
Multiset list assignment operator.
ISO C++ entities toplevel namespace is std.
void insert(_InputIterator __first, _InputIterator __last)
A template function that tries to insert a range of elements.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
reverse_iterator crend() const noexcept
multiset()
Default constructor creates no elements.
bool empty() const noexcept
Returns true if the set is empty.
reverse_iterator rend() const noexcept
size_type max_size() const noexcept
Returns the maximum size of the set.
multiset & operator=(multiset &&__x)
Multiset move assignment operator.
multiset(multiset &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Multiset move constructor.
iterator cend() const noexcept
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Builds and inserts an element into the multiset.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
iterator cbegin() const noexcept
multiset(_InputIterator __first, _InputIterator __last)
Builds a multiset from a range.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
multiset(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a multiset from a range.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
Struct holding two objects of arbitrary type.
A standard container made up of elements, which can be retrieved in logarithmic time.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multiset.
reverse_iterator rbegin() const noexcept
allocator_type get_allocator() const noexcept
Returns the memory allocation object.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
iterator end() const noexcept