57 #ifndef _STL_MULTISET_H
58 #define _STL_MULTISET_H 1
63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
84 template <
typename _Key,
typename _Compare = std::less<_Key>,
85 typename _Alloc = std::allocator<_Key> >
89 typedef typename _Alloc::value_type _Alloc_value_type;
90 __glibcxx_class_requires(_Key, _SGIAssignableConcept)
91 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
92 _BinaryFunctionConcept)
93 __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)
97 typedef _Key key_type;
98 typedef _Key value_type;
99 typedef _Compare key_compare;
100 typedef _Compare value_compare;
101 typedef _Alloc allocator_type;
105 typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;
107 typedef _Rb_tree<key_type, value_type, _Identity<value_type>,
108 key_compare, _Key_alloc_type> _Rep_type;
113 typedef typename _Key_alloc_type::pointer pointer;
114 typedef typename _Key_alloc_type::const_pointer const_pointer;
115 typedef typename _Key_alloc_type::reference reference;
116 typedef typename _Key_alloc_type::const_reference const_reference;
120 typedef typename _Rep_type::const_iterator iterator;
121 typedef typename _Rep_type::const_iterator const_iterator;
124 typedef typename _Rep_type::size_type size_type;
125 typedef typename _Rep_type::difference_type difference_type;
141 const allocator_type& __a = allocator_type())
142 : _M_t(__comp, __a) { }
153 template<
typename _InputIterator>
154 multiset(_InputIterator __first, _InputIterator __last)
156 { _M_t._M_insert_equal(__first, __last); }
169 template<
typename _InputIterator>
170 multiset(_InputIterator __first, _InputIterator __last,
171 const _Compare& __comp,
172 const allocator_type& __a = allocator_type())
174 { _M_t._M_insert_equal(__first, __last); }
186 #ifdef __GXX_EXPERIMENTAL_CXX0X__
195 : _M_t(std::move(__x._M_t)) { }
208 const _Compare& __comp = _Compare(),
209 const allocator_type& __a = allocator_type())
211 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
228 #ifdef __GXX_EXPERIMENTAL_CXX0X__
261 this->
insert(__l.begin(), __l.end());
271 {
return _M_t.key_comp(); }
275 {
return _M_t.key_comp(); }
279 {
return _M_t.get_allocator(); }
288 {
return _M_t.begin(); }
297 {
return _M_t.end(); }
306 {
return _M_t.rbegin(); }
315 {
return _M_t.rend(); }
317 #ifdef __GXX_EXPERIMENTAL_CXX0X__
325 {
return _M_t.begin(); }
334 {
return _M_t.end(); }
343 {
return _M_t.rbegin(); }
352 {
return _M_t.rend(); }
358 {
return _M_t.empty(); }
363 {
return _M_t.size(); }
368 {
return _M_t.max_size(); }
383 { _M_t.swap(__x._M_t); }
399 {
return _M_t._M_insert_equal(__x); }
401 #ifdef __GXX_EXPERIMENTAL_CXX0X__
404 {
return _M_t._M_insert_equal(std::move(__x)); }
428 insert(const_iterator __position,
const value_type& __x)
429 {
return _M_t._M_insert_equal_(__position, __x); }
431 #ifdef __GXX_EXPERIMENTAL_CXX0X__
433 insert(const_iterator __position, value_type&& __x)
434 {
return _M_t._M_insert_equal_(__position, std::move(__x)); }
445 template<
typename _InputIterator>
447 insert(_InputIterator __first, _InputIterator __last)
448 { _M_t._M_insert_equal(__first, __last); }
450 #ifdef __GXX_EXPERIMENTAL_CXX0X__
460 { this->
insert(__l.begin(), __l.end()); }
463 #ifdef __GXX_EXPERIMENTAL_CXX0X__
481 {
return _M_t.erase(__position); }
495 { _M_t.erase(__position); }
511 {
return _M_t.erase(__x); }
513 #ifdef __GXX_EXPERIMENTAL_CXX0X__
530 erase(const_iterator __first, const_iterator __last)
531 {
return _M_t.erase(__first, __last); }
547 { _M_t.erase(__first, __last); }
569 {
return _M_t.count(__x); }
587 {
return _M_t.find(__x); }
590 find(
const key_type& __x)
const
591 {
return _M_t.find(__x); }
608 {
return _M_t.lower_bound(__x); }
612 {
return _M_t.lower_bound(__x); }
624 {
return _M_t.upper_bound(__x); }
628 {
return _M_t.upper_bound(__x); }
649 {
return _M_t.equal_range(__x); }
653 {
return _M_t.equal_range(__x); }
655 template<
typename _K1,
typename _C1,
typename _A1>
660 template<
typename _K1,
typename _C1,
typename _A1>
662 operator< (const multiset<_K1, _C1, _A1>&,
677 template<
typename _Key,
typename _Compare,
typename _Alloc>
681 {
return __x._M_t == __y._M_t; }
694 template<
typename _Key,
typename _Compare,
typename _Alloc>
696 operator<(const multiset<_Key, _Compare, _Alloc>& __x,
698 {
return __x._M_t < __y._M_t; }
701 template<
typename _Key,
typename _Compare,
typename _Alloc>
705 {
return !(__x == __y); }
708 template<
typename _Key,
typename _Compare,
typename _Alloc>
712 {
return __y < __x; }
715 template<
typename _Key,
typename _Compare,
typename _Alloc>
717 operator<=(const multiset<_Key, _Compare, _Alloc>& __x,
719 {
return !(__y < __x); }
722 template<
typename _Key,
typename _Compare,
typename _Alloc>
726 {
return !(__x < __y); }
729 template<
typename _Key,
typename _Compare,
typename _Alloc>
735 _GLIBCXX_END_NAMESPACE_CONTAINER
multiset(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multiset with no elements.
multiset(_InputIterator __first, _InputIterator __last)
Builds a multiset from a range.
Struct holding two objects of arbitrary type.
void swap(multiset &__x)
Swaps data with another multiset.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multiset.
reverse_iterator crend() const
iterator find(const key_type &__x)
Tries to locate an element in a set.
iterator erase(const_iterator __position)
Erases an element from a multiset.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
A standard container made up of elements, which can be retrieved in logarithmic time.
multiset & operator=(initializer_list< value_type > __l)
Multiset list assignment operator.
iterator insert(const_iterator __position, const value_type &__x)
Inserts an element into the multiset.
void insert(_InputIterator __first, _InputIterator __last)
A template function that tries to insert a range of elements.
reverse_iterator crbegin() const
multiset()
Default constructor creates no elements.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the multiset.
reverse_iterator rbegin() const
multiset(const multiset &__x)
Multiset copy constructor.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
multiset(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a multiset from a range.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
value_compare value_comp() const
Returns the comparison object.
const_iterator find(const key_type &__x) const
Tries to locate an element in a set.
multiset & operator=(multiset &&__x)
Multiset move assignment operator.
key_compare key_comp() const
Returns the comparison object.
friend bool operator==(const multiset< _K1, _C1, _A1 > &, const multiset< _K1, _C1, _A1 > &)
Finds a subsequence matching given key.
size_type size() const
Returns the size of the set.
reverse_iterator rend() const
allocator_type get_allocator() const
Returns the memory allocation object.
size_type max_size() const
Returns the maximum size of the set.
bool empty() const
Returns true if the set is empty.
multiset & operator=(const multiset &__x)
Multiset assignment operator.
multiset(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multiset from an initializer_list.
multiset(multiset &&__x)
Multiset move constructor.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator insert(const value_type &__x)
Inserts an element into the multiset.