57 #ifndef _STL_MULTIMAP_H
58 #define _STL_MULTIMAP_H 1
61 #ifdef __GXX_EXPERIMENTAL_CXX0X__
65 namespace std _GLIBCXX_VISIBILITY(default)
67 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
87 template <
typename _Key,
typename _Tp,
93 typedef _Key key_type;
94 typedef _Tp mapped_type;
96 typedef _Compare key_compare;
97 typedef _Alloc allocator_type;
101 typedef typename _Alloc::value_type _Alloc_value_type;
102 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
103 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
104 _BinaryFunctionConcept)
105 __glibcxx_class_requires2(
value_type, _Alloc_value_type, _SameTypeConcept)
111 friend class multimap<_Key, _Tp, _Compare, _Alloc>;
115 value_compare(_Compare __c)
125 typedef typename _Alloc::template rebind<value_type>::other
128 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
129 key_compare, _Pair_alloc_type> _Rep_type;
136 typedef typename _Pair_alloc_type::pointer pointer;
137 typedef typename _Pair_alloc_type::const_pointer const_pointer;
138 typedef typename _Pair_alloc_type::reference reference;
139 typedef typename _Pair_alloc_type::const_reference const_reference;
140 typedef typename _Rep_type::iterator iterator;
141 typedef typename _Rep_type::const_iterator const_iterator;
142 typedef typename _Rep_type::size_type size_type;
143 typedef typename _Rep_type::difference_type difference_type;
162 const allocator_type& __a = allocator_type())
163 : _M_t(__comp, _Pair_alloc_type(__a)) { }
175 #ifdef __GXX_EXPERIMENTAL_CXX0X__
185 : _M_t(std::move(__x._M_t)) { }
198 const _Compare& __comp = _Compare(),
199 const allocator_type& __a = allocator_type())
200 : _M_t(__comp, _Pair_alloc_type(__a))
201 { _M_t._M_insert_equal(__l.begin(), __l.end()); }
213 template<
typename _InputIterator>
214 multimap(_InputIterator __first, _InputIterator __last)
216 { _M_t._M_insert_equal(__first, __last); }
229 template<
typename _InputIterator>
230 multimap(_InputIterator __first, _InputIterator __last,
231 const _Compare& __comp,
232 const allocator_type& __a = allocator_type())
233 : _M_t(__comp, _Pair_alloc_type(__a))
234 { _M_t._M_insert_equal(__first, __last); }
259 #ifdef __GXX_EXPERIMENTAL_CXX0X__
292 this->
insert(__l.begin(), __l.end());
300 {
return allocator_type(_M_t.get_allocator()); }
310 {
return _M_t.begin(); }
319 {
return _M_t.begin(); }
328 {
return _M_t.end(); }
336 end() const _GLIBCXX_NOEXCEPT
337 {
return _M_t.end(); }
346 {
return _M_t.rbegin(); }
353 const_reverse_iterator
355 {
return _M_t.rbegin(); }
364 {
return _M_t.rend(); }
371 const_reverse_iterator
373 {
return _M_t.rend(); }
375 #ifdef __GXX_EXPERIMENTAL_CXX0X__
383 {
return _M_t.begin(); }
392 {
return _M_t.end(); }
399 const_reverse_iterator
401 {
return _M_t.rbegin(); }
408 const_reverse_iterator
410 {
return _M_t.rend(); }
417 {
return _M_t.empty(); }
422 {
return _M_t.size(); }
427 {
return _M_t.max_size(); }
444 {
return _M_t._M_insert_equal(__x); }
446 #ifdef __GXX_EXPERIMENTAL_CXX0X__
447 template<
typename _Pair,
typename =
typename
449 _Pair&&>::value>::type>
452 {
return _M_t._M_insert_equal(std::forward<_Pair>(__x)); }
476 #ifdef __GXX_EXPERIMENTAL_CXX0X__
481 {
return _M_t._M_insert_equal_(__position, __x); }
483 #ifdef __GXX_EXPERIMENTAL_CXX0X__
484 template<
typename _Pair,
typename =
typename
486 _Pair&&>::value>::type>
488 insert(const_iterator __position, _Pair&& __x)
489 {
return _M_t._M_insert_equal_(__position,
490 std::forward<_Pair>(__x)); }
502 template<
typename _InputIterator>
504 insert(_InputIterator __first, _InputIterator __last)
505 { _M_t._M_insert_equal(__first, __last); }
507 #ifdef __GXX_EXPERIMENTAL_CXX0X__
517 { this->
insert(__l.begin(), __l.end()); }
520 #ifdef __GXX_EXPERIMENTAL_CXX0X__
538 {
return _M_t.erase(__position); }
543 {
return _M_t.erase(__position); }
556 erase(iterator __position)
557 { _M_t.erase(__position); }
573 {
return _M_t.erase(__x); }
575 #ifdef __GXX_EXPERIMENTAL_CXX0X__
593 erase(const_iterator __first, const_iterator __last)
594 {
return _M_t.erase(__first, __last); }
613 { _M_t.erase(__first, __last); }
629 { _M_t.swap(__x._M_t); }
648 {
return _M_t.key_comp(); }
656 {
return value_compare(_M_t.key_comp()); }
672 {
return _M_t.find(__x); }
686 find(
const key_type& __x)
const
687 {
return _M_t.find(__x); }
696 {
return _M_t.count(__x); }
711 {
return _M_t.lower_bound(__x); }
726 {
return _M_t.lower_bound(__x); }
736 {
return _M_t.upper_bound(__x); }
746 {
return _M_t.upper_bound(__x); }
763 {
return _M_t.equal_range(__x); }
780 {
return _M_t.equal_range(__x); }
782 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
787 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
789 operator<(const multimap<_K1, _T1, _C1, _A1>&,
803 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
807 {
return __x._M_t == __y._M_t; }
820 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
822 operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
824 {
return __x._M_t < __y._M_t; }
827 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
831 {
return !(__x == __y); }
834 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
838 {
return __y < __x; }
841 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
843 operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,
845 {
return !(__y < __x); }
848 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
852 {
return !(__x < __y); }
855 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
861 _GLIBCXX_END_NAMESPACE_CONTAINER
const_iterator cbegin() const noexcept
multimap(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multimap from an initializer_list.
_T1 first
second_type is the second bound type
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
The standard allocator, as per [20.4].
bool empty() const _GLIBCXX_NOEXCEPT
iterator begin() _GLIBCXX_NOEXCEPT
size_type count(const key_type &__x) const
Finds the number of elements with given key.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
multimap & operator=(const multimap &__x)
Multimap assignment operator.
const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT
bool operator>(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
iterator insert(const_iterator __position, const value_type &__x)
Inserts a std::pair into the multimap.
void clear() _GLIBCXX_NOEXCEPT
multimap(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multimap with no elements.
key_compare key_comp() const
Define a member typedef type only if a boolean constant is true.
const_reverse_iterator crend() const noexcept
bool operator!=(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator==.
One of the comparison functors.
value_compare value_comp() const
iterator end() _GLIBCXX_NOEXCEPT
bool operator>=(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
iterator erase(const_iterator __position)
Erases an element from a multimap.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
reverse_iterator rbegin() _GLIBCXX_NOEXCEPT
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
size_type max_size() const _GLIBCXX_NOEXCEPT
iterator find(const key_type &__x)
Tries to locate an element in a multimap.
bool operator==(const multimap< _Key, _Tp, _Compare, _Alloc > &__x, const multimap< _Key, _Tp, _Compare, _Alloc > &__y)
Multimap equality comparison.
const_iterator begin() const _GLIBCXX_NOEXCEPT
const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT
size_type erase(const key_type &__x)
Erases elements according to the provided key.
multimap()
Default constructor creates no elements.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
size_type size() const _GLIBCXX_NOEXCEPT
void swap(multimap &__x)
Swaps data with another multimap.
const_iterator find(const key_type &__x) const
Tries to locate an element in a multimap.
multimap & operator=(initializer_list< value_type > __l)
Multimap list assignment operator.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multimap.
Struct holding two objects of arbitrary type.
const_reverse_iterator crbegin() const noexcept
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
multimap(_InputIterator __first, _InputIterator __last)
Builds a multimap from a range.
const_iterator cend() const noexcept
void swap(multimap< _Key, _Tp, _Compare, _Alloc > &__x, multimap< _Key, _Tp, _Compare, _Alloc > &__y)
See std::multimap::swap().
reverse_iterator rend() _GLIBCXX_NOEXCEPT
const_iterator end() const _GLIBCXX_NOEXCEPT
multimap(multimap &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Multimap move constructor.
allocator_type get_allocator() const _GLIBCXX_NOEXCEPT
Get a copy of the memory allocation object.
multimap & operator=(multimap &&__x)
Multimap move assignment operator.
is_nothrow_copy_constructible
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
multimap(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a multimap from a range.
multimap(const multimap &__x)
Multimap copy constructor.
iterator insert(const value_type &__x)
Inserts a std::pair into the multimap.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of std::pairs into the multimap.