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;
112 rebind<_Key>::other _Key_alloc_type;
114 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
115 key_compare, _Key_alloc_type> _Rep_type;
122 typedef typename _Alloc_traits::pointer pointer;
123 typedef typename _Alloc_traits::const_pointer const_pointer;
124 typedef typename _Alloc_traits::reference reference;
125 typedef typename _Alloc_traits::const_reference const_reference;
129 typedef typename _Rep_type::const_iterator iterator;
130 typedef typename _Rep_type::const_iterator const_iterator;
133 typedef typename _Rep_type::size_type size_type;
134 typedef typename _Rep_type::difference_type difference_type;
150 const allocator_type& __a = allocator_type())
151 : _M_t(__comp, _Key_alloc_type(__a)) { }
162 template<
typename _InputIterator>
163 multiset(_InputIterator __first, _InputIterator __last)
165 { _M_t._M_insert_equal(__first, __last); }
178 template<
typename _InputIterator>
179 multiset(_InputIterator __first, _InputIterator __last,
180 const _Compare& __comp,
181 const allocator_type& __a = allocator_type())
182 : _M_t(__comp, _Key_alloc_type(__a))
183 { _M_t._M_insert_equal(__first, __last); }
195 #if __cplusplus >= 201103L
204 noexcept(is_nothrow_copy_constructible<_Compare>::value)
205 : _M_t(
std::
move(__x._M_t)) { }
218 const _Compare& __comp = _Compare(),
219 const allocator_type& __a = allocator_type())
220 : _M_t(__comp, _Key_alloc_type(__a))
221 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
226 : _M_t(_Compare(), _Key_alloc_type(__a)) { }
230 : _M_t(__m._M_t, _Key_alloc_type(__a)) { }
234 noexcept(is_nothrow_copy_constructible<_Compare>::value
235 && _Alloc_traits::_S_always_equal())
236 : _M_t(
std::
move(__m._M_t), _Key_alloc_type(__a)) { }
239 multiset(initializer_list<value_type> __l,
const allocator_type& __a)
240 : _M_t(_Compare(), _Key_alloc_type(__a))
241 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
244 template<
typename _InputIterator>
245 multiset(_InputIterator __first, _InputIterator __last,
246 const allocator_type& __a)
247 : _M_t(_Compare(), _Key_alloc_type(__a))
248 { _M_t._M_insert_equal(__first, __last); }
265 #if __cplusplus >= 201103L
277 if (!_M_t._M_move_assign(__x._M_t))
282 insert(std::__make_move_if_noexcept_iterator(__x._M_t.begin()),
283 std::__make_move_if_noexcept_iterator(__x._M_t.end()));
304 this->
insert(__l.begin(), __l.end());
314 {
return _M_t.key_comp(); }
318 {
return _M_t.key_comp(); }
322 {
return allocator_type(_M_t.get_allocator()); }
331 {
return _M_t.begin(); }
339 end() const _GLIBCXX_NOEXCEPT
340 {
return _M_t.end(); }
349 {
return _M_t.rbegin(); }
358 {
return _M_t.rend(); }
360 #if __cplusplus >= 201103L
368 {
return _M_t.begin(); }
377 {
return _M_t.end(); }
386 {
return _M_t.rbegin(); }
395 {
return _M_t.rend(); }
401 {
return _M_t.empty(); }
406 {
return _M_t.size(); }
411 {
return _M_t.max_size(); }
426 #if __cplusplus >= 201103L
427 noexcept(_Alloc_traits::_S_nothrow_swap())
429 { _M_t.swap(__x._M_t); }
432 #if __cplusplus >= 201103L
445 template<
typename... _Args>
448 {
return _M_t._M_emplace_equal(std::forward<_Args>(__args)...); }
471 template<
typename... _Args>
475 return _M_t._M_emplace_hint_equal(__pos,
476 std::forward<_Args>(__args)...);
493 {
return _M_t._M_insert_equal(__x); }
495 #if __cplusplus >= 201103L
498 {
return _M_t._M_insert_equal(
std::move(__x)); }
522 insert(const_iterator __position,
const value_type& __x)
523 {
return _M_t._M_insert_equal_(__position, __x); }
525 #if __cplusplus >= 201103L
527 insert(const_iterator __position, value_type&& __x)
528 {
return _M_t._M_insert_equal_(__position,
std::move(__x)); }
539 template<
typename _InputIterator>
541 insert(_InputIterator __first, _InputIterator __last)
542 { _M_t._M_insert_equal(__first, __last); }
544 #if __cplusplus >= 201103L
554 { this->
insert(__l.begin(), __l.end()); }
557 #if __cplusplus >= 201103L
573 _GLIBCXX_ABI_TAG_CXX11
576 {
return _M_t.erase(__position); }
589 erase(iterator __position)
590 { _M_t.erase(__position); }
606 {
return _M_t.erase(__x); }
608 #if __cplusplus >= 201103L
625 _GLIBCXX_ABI_TAG_CXX11
627 erase(const_iterator __first, const_iterator __last)
628 {
return _M_t.erase(__first, __last); }
643 erase(iterator __first, iterator __last)
644 { _M_t.erase(__first, __last); }
666 {
return _M_t.count(__x); }
684 {
return _M_t.find(__x); }
687 find(
const key_type& __x)
const
688 {
return _M_t.find(__x); }
705 {
return _M_t.lower_bound(__x); }
709 {
return _M_t.lower_bound(__x); }
721 {
return _M_t.upper_bound(__x); }
725 {
return _M_t.upper_bound(__x); }
746 {
return _M_t.equal_range(__x); }
750 {
return _M_t.equal_range(__x); }
753 template<
typename _K1,
typename _C1,
typename _A1>
758 template<
typename _K1,
typename _C1,
typename _A1>
760 operator< (const multiset<_K1, _C1, _A1>&,
775 template<
typename _Key,
typename _Compare,
typename _Alloc>
779 {
return __x._M_t == __y._M_t; }
792 template<
typename _Key,
typename _Compare,
typename _Alloc>
794 operator<(const multiset<_Key, _Compare, _Alloc>& __x,
796 {
return __x._M_t < __y._M_t; }
799 template<
typename _Key,
typename _Compare,
typename _Alloc>
803 {
return !(__x == __y); }
806 template<
typename _Key,
typename _Compare,
typename _Alloc>
810 {
return __y < __x; }
813 template<
typename _Key,
typename _Compare,
typename _Alloc>
815 operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
817 {
return !(__y < __x); }
820 template<
typename _Key,
typename _Compare,
typename _Alloc>
824 {
return !(__x < __y); }
827 template<
typename _Key,
typename _Compare,
typename _Alloc>
833 _GLIBCXX_END_NAMESPACE_CONTAINER
multiset(_InputIterator __first, _InputIterator __last)
Builds a multiset from a range.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __position)
Erases an element from a multiset.
multiset(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
iterator insert(const_iterator __position, const value_type &__x)
Inserts an element into the multiset.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
reverse_iterator crend() const noexcept
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
reverse_iterator crbegin() const noexcept
iterator cend() const noexcept
reverse_iterator rend() const noexcept
multiset(const multiset &__x)
Multiset copy constructor.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
Uniform interface to C++98 and C++0x allocators.
iterator end() const noexcept
multiset(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multiset from an initializer_list.
multiset & operator=(multiset &&__x) noexcept(_Alloc_traits::_S_nothrow_move())
Multiset move assignment operator.
void insert(_InputIterator __first, _InputIterator __last)
A template function that tries to insert a range of elements.
size_type max_size() const noexcept
Returns the maximum size of the set.
allocator_type get_allocator() const noexcept
Returns the memory allocation object.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator insert(const value_type &__x)
Inserts an element into the multiset.
size_type size() const noexcept
Returns the size of the set.
key_compare key_comp() const
Returns the comparison object.
multiset(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
ISO C++ entities toplevel namespace is std.
iterator emplace(_Args &&...__args)
Builds and inserts an element into the multiset.
multiset & operator=(const multiset &__x)
Multiset assignment operator.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
reverse_iterator rbegin() const noexcept
multiset(const allocator_type &__a)
Allocator-extended default constructor.
bool empty() const noexcept
Returns true if the set is empty.
multiset(multiset &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Multiset move constructor.
_GLIBCXX_ABI_TAG_CXX11 iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multiset.
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.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
iterator cbegin() const noexcept
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Builds and inserts an element into the multiset.
multiset(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multiset with no elements.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
A standard container made up of elements, which can be retrieved in logarithmic time.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
value_compare value_comp() const
Returns the comparison object.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
iterator find(const key_type &__x)
Tries to locate an element in a set.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the multiset.
Struct holding two objects of arbitrary type.
multiset & operator=(initializer_list< value_type > __l)
Multiset list assignment operator.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
iterator begin() const noexcept
multiset(multiset &&__m, const allocator_type &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())
Allocator-extended move constructor.
multiset(const multiset &__m, const allocator_type &__a)
Allocator-extended copy constructor.
void swap(multiset &__x) noexcept(_Alloc_traits::_S_nothrow_swap())
Swaps data with another multiset.
multiset()
Default constructor creates no elements.