57 #ifndef _STL_MULTIMAP_H
58 #define _STL_MULTIMAP_H 1
63 namespace std _GLIBCXX_VISIBILITY(default)
65 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
85 template <
typename _Key,
typename _Tp,
91 typedef _Key key_type;
92 typedef _Tp mapped_type;
94 typedef _Compare key_compare;
95 typedef _Alloc allocator_type;
99 typedef typename _Alloc::value_type _Alloc_value_type;
100 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
101 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
102 _BinaryFunctionConcept)
103 __glibcxx_class_requires2(
value_type, _Alloc_value_type, _SameTypeConcept)
109 friend class multimap<_Key, _Tp, _Compare, _Alloc>;
113 value_compare(_Compare __c)
123 typedef typename _Alloc::template rebind<value_type>::other
126 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
127 key_compare, _Pair_alloc_type> _Rep_type;
134 typedef typename _Pair_alloc_type::pointer pointer;
135 typedef typename _Pair_alloc_type::const_pointer const_pointer;
136 typedef typename _Pair_alloc_type::reference reference;
137 typedef typename _Pair_alloc_type::const_reference const_reference;
138 typedef typename _Rep_type::iterator iterator;
139 typedef typename _Rep_type::const_iterator const_iterator;
140 typedef typename _Rep_type::size_type size_type;
141 typedef typename _Rep_type::difference_type difference_type;
160 const allocator_type& __a = allocator_type())
161 : _M_t(__comp, __a) { }
173 #ifdef __GXX_EXPERIMENTAL_CXX0X__
182 : _M_t(std::move(__x._M_t)) { }
195 const _Compare& __comp = _Compare(),
196 const allocator_type& __a = allocator_type())
198 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
210 template<
typename _InputIterator>
211 multimap(_InputIterator __first, _InputIterator __last)
213 { _M_t._M_insert_equal(__first, __last); }
226 template<
typename _InputIterator>
227 multimap(_InputIterator __first, _InputIterator __last,
228 const _Compare& __comp,
229 const allocator_type& __a = allocator_type())
231 { _M_t._M_insert_equal(__first, __last); }
256 #ifdef __GXX_EXPERIMENTAL_CXX0X__
289 this->
insert(__l.begin(), __l.end());
297 {
return _M_t.get_allocator(); }
307 {
return _M_t.begin(); }
316 {
return _M_t.begin(); }
325 {
return _M_t.end(); }
334 {
return _M_t.end(); }
343 {
return _M_t.rbegin(); }
350 const_reverse_iterator
352 {
return _M_t.rbegin(); }
361 {
return _M_t.rend(); }
368 const_reverse_iterator
370 {
return _M_t.rend(); }
372 #ifdef __GXX_EXPERIMENTAL_CXX0X__
380 {
return _M_t.begin(); }
389 {
return _M_t.end(); }
396 const_reverse_iterator
398 {
return _M_t.rbegin(); }
405 const_reverse_iterator
407 {
return _M_t.rend(); }
414 {
return _M_t.empty(); }
419 {
return _M_t.size(); }
424 {
return _M_t.max_size(); }
441 {
return _M_t._M_insert_equal(__x); }
443 #ifdef __GXX_EXPERIMENTAL_CXX0X__
444 template<
typename _Pair,
typename =
typename
446 value_type>::value>::type>
449 {
return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
473 #ifdef __GXX_EXPERIMENTAL_CXX0X__
478 {
return _M_t._M_insert_equal_(__position, __x); }
480 #ifdef __GXX_EXPERIMENTAL_CXX0X__
481 template<
typename _Pair,
typename =
typename
483 value_type>::value>::type>
485 insert(const_iterator __position, _Pair&& __x)
486 {
return _M_t._M_insert_equal_(__position,
487 std::forward<_Pair>(__x)); }
499 template<
typename _InputIterator>
501 insert(_InputIterator __first, _InputIterator __last)
502 { _M_t._M_insert_equal(__first, __last); }
504 #ifdef __GXX_EXPERIMENTAL_CXX0X__
514 { this->
insert(__l.begin(), __l.end()); }
517 #ifdef __GXX_EXPERIMENTAL_CXX0X__
535 {
return _M_t.erase(__position); }
540 {
return _M_t.erase(__position); }
553 erase(iterator __position)
554 { _M_t.erase(__position); }
570 {
return _M_t.erase(__x); }
572 #ifdef __GXX_EXPERIMENTAL_CXX0X__
589 erase(const_iterator __first, const_iterator __last)
590 {
return _M_t.erase(__first, __last); }
608 { _M_t.erase(__first, __last); }
624 { _M_t.swap(__x._M_t); }
643 {
return _M_t.key_comp(); }
651 {
return value_compare(_M_t.key_comp()); }
667 {
return _M_t.find(__x); }
681 find(
const key_type& __x)
const
682 {
return _M_t.find(__x); }
691 {
return _M_t.count(__x); }
706 {
return _M_t.lower_bound(__x); }
721 {
return _M_t.lower_bound(__x); }
731 {
return _M_t.upper_bound(__x); }
741 {
return _M_t.upper_bound(__x); }
758 {
return _M_t.equal_range(__x); }
775 {
return _M_t.equal_range(__x); }
777 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
782 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
784 operator<(const multimap<_K1, _T1, _C1, _A1>&,
798 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
802 {
return __x._M_t == __y._M_t; }
815 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
817 operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
819 {
return __x._M_t < __y._M_t; }
822 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
826 {
return !(__x == __y); }
829 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
833 {
return __y < __x; }
836 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
838 operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
840 {
return !(__y < __x); }
843 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
847 {
return !(__x < __y); }
850 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
856 _GLIBCXX_END_NAMESPACE_CONTAINER
size_type max_size() const
Struct holding two objects of arbitrary type.
multimap(_InputIterator __first, _InputIterator __last)
Builds a multimap from a range.
allocator_type get_allocator() const
Get a copy of the memory allocation object.
_T1 first
second_type is the second bound type
multimap(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multimap from an initializer_list.
const_reverse_iterator rend() const
void swap(multimap &__x)
Swaps data with another multimap.
multimap & operator=(multimap &&__x)
Multimap move assignment operator.
const_reverse_iterator crend() const
const_iterator end() const
bool operator==(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Multimap equality comparison.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
multimap & operator=(initializer_list< value_type > __l)
Multimap list assignment operator.
void swap(multimap< _Key, _Tp, _Compare, _Alloc > &__x, multimap< _Key, _Tp, _Compare, _Alloc > &__y)
See std::multimap::swap().
bool operator>(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
const_iterator begin() const
const_reverse_iterator rbegin() const
multimap(const multimap &__x)
Multimap copy constructor.
multimap(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multimap with no elements.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
const_iterator cend() const
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multimap.
multimap & operator=(const multimap &__x)
Multimap assignment operator.
key_compare key_comp() const
bool operator>=(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
iterator insert(const value_type &__x)
Inserts a std::pair into the multimap.
reverse_iterator rbegin()
multimap()
Default constructor creates no elements.
const_iterator cbegin() const
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
value_compare value_comp() const
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of std::pairs into the multimap.
One of the comparison functors.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
iterator insert(const_iterator __position, const value_type &__x)
Inserts a std::pair into the multimap.
const_iterator find(const key_type &__x) const
Tries to locate an element in a multimap.
multimap(multimap &&__x)
Multimap move constructor.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
bool operator!=(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator==.
multimap(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a multimap from a range.
const_reverse_iterator crbegin() const
The standard allocator, as per [20.4].Further details: http://gcc.gnu.org/onlinedocs/libstdc++/manual...
iterator erase(const_iterator __position)
Erases an element from a multimap.
iterator find(const key_type &__x)
Tries to locate an element in a multimap.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...