56#ifndef _STL_MULTIMAP_H
57#define _STL_MULTIMAP_H 1
60#if __cplusplus >= 201103L
64namespace std _GLIBCXX_VISIBILITY(default)
66_GLIBCXX_BEGIN_NAMESPACE_CONTAINER
92 template <
typename _Key,
typename _Tp,
99 typedef _Tp mapped_type;
101 typedef _Compare key_compare;
102 typedef _Alloc allocator_type;
106 typedef typename _Alloc::value_type _Alloc_value_type;
107 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
108 __glibcxx_class_requires4(_Compare,
bool,
_Key,
_Key,
109 _BinaryFunctionConcept)
110 __glibcxx_class_requires2(
value_type, _Alloc_value_type, _SameTypeConcept)
120 value_compare(_Compare __c)
125 {
return comp(__x.first,
__y.first); }
131 rebind<value_type>::other _Pair_alloc_type;
134 key_compare, _Pair_alloc_type> _Rep_type;
144 typedef typename _Alloc_traits::const_pointer const_pointer;
145 typedef typename _Alloc_traits::reference reference;
146 typedef typename _Alloc_traits::const_reference const_reference;
149 typedef typename _Rep_type::size_type size_type;
173 const allocator_type& __a = allocator_type())
174 : _M_t(__comp, _Pair_alloc_type(__a)) { }
186#if __cplusplus >= 201103L
196 : _M_t(
std::move(__x._M_t)) { }
209 const _Compare& __comp = _Compare(),
210 const allocator_type& __a = allocator_type())
211 : _M_t(__comp, _Pair_alloc_type(__a))
212 { _M_t._M_insert_equal(
__l.begin(),
__l.end()); }
217 : _M_t(_Compare(), _Pair_alloc_type(__a)) { }
221 : _M_t(__m._M_t, _Pair_alloc_type(__a)) { }
226 && _Alloc_traits::_S_always_equal())
227 : _M_t(
std::move(__m._M_t), _Pair_alloc_type(__a)) { }
231 : _M_t(_Compare(), _Pair_alloc_type(__a))
232 { _M_t._M_insert_equal(
__l.begin(),
__l.end()); }
235 template<
typename _InputIterator>
237 const allocator_type& __a)
238 : _M_t(_Compare(), _Pair_alloc_type(__a))
239 { _M_t._M_insert_equal(__first, __last); }
251 template<
typename _InputIterator>
254 { _M_t._M_insert_equal(__first, __last); }
267 template<
typename _InputIterator>
269 const _Compare& __comp,
270 const allocator_type& __a = allocator_type())
271 : _M_t(__comp, _Pair_alloc_type(__a))
272 { _M_t._M_insert_equal(__first, __last); }
297#if __cplusplus >= 201103L
316 _M_t._M_assign_equal(
__l.begin(),
__l.end());
324 {
return allocator_type(_M_t.get_allocator()); }
334 {
return _M_t.begin(); }
343 {
return _M_t.begin(); }
352 {
return _M_t.end(); }
361 {
return _M_t.end(); }
370 {
return _M_t.rbegin(); }
377 const_reverse_iterator
379 {
return _M_t.rbegin(); }
388 {
return _M_t.rend(); }
395 const_reverse_iterator
397 {
return _M_t.rend(); }
399#if __cplusplus >= 201103L
407 {
return _M_t.begin(); }
416 {
return _M_t.end(); }
423 const_reverse_iterator
425 {
return _M_t.rbegin(); }
432 const_reverse_iterator
434 {
return _M_t.rend(); }
441 {
return _M_t.empty(); }
446 {
return _M_t.size(); }
451 {
return _M_t.max_size(); }
454#if __cplusplus >= 201103L
471 template<
typename...
_Args>
498 template<
typename...
_Args>
502 return _M_t._M_emplace_hint_equal(
__pos,
521 {
return _M_t._M_insert_equal(__x); }
523#if __cplusplus >= 201103L
524 template<
typename _Pair,
typename =
typename
526 _Pair&&>::value>::type>
553#if __cplusplus >= 201103L
558 {
return _M_t._M_insert_equal_(
__position, __x); }
560#if __cplusplus >= 201103L
561 template<
typename _Pair,
typename =
typename
563 _Pair&&>::value>::type>
579 template<
typename _InputIterator>
582 { _M_t._M_insert_equal(__first, __last); }
584#if __cplusplus >= 201103L
594 { this->
insert(__l.begin(),
__l.end()); }
597#if __cplusplus >= 201103L
618 _GLIBCXX_ABI_TAG_CXX11
634 erase(iterator __position)
635 { _M_t.erase(__position); }
651 {
return _M_t.erase(__x); }
653#if __cplusplus >= 201103L
672 {
return _M_t.erase(__first, __last); }
691 { _M_t.erase(__first, __last); }
708 { _M_t.swap(__x._M_t); }
727 {
return _M_t.key_comp(); }
735 {
return value_compare(_M_t.key_comp()); }
753 {
return _M_t.find(__x); }
755#if __cplusplus > 201103L
756 template<
typename _Kt>
758 find(
const _Kt& __x) ->
decltype(_M_t._M_find_tr(__x))
759 {
return _M_t._M_find_tr(__x); }
777 {
return _M_t.find(__x); }
779#if __cplusplus > 201103L
780 template<
typename _Kt>
782 find(
const _Kt& __x)
const ->
decltype(_M_t._M_find_tr(__x))
783 {
return _M_t._M_find_tr(__x); }
795 {
return _M_t.count(__x); }
797#if __cplusplus > 201103L
798 template<
typename _Kt>
800 count(
const _Kt& __x)
const ->
decltype(_M_t._M_count_tr(__x))
801 {
return _M_t._M_count_tr(__x); }
819 {
return _M_t.lower_bound(__x); }
821#if __cplusplus > 201103L
822 template<
typename _Kt>
825 ->
decltype(
iterator(_M_t._M_lower_bound_tr(__x)))
826 {
return iterator(_M_t._M_lower_bound_tr(__x)); }
844 {
return _M_t.lower_bound(__x); }
846#if __cplusplus > 201103L
847 template<
typename _Kt>
850 ->
decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
851 {
return const_iterator(_M_t._M_lower_bound_tr(__x)); }
864 {
return _M_t.upper_bound(__x); }
866#if __cplusplus > 201103L
867 template<
typename _Kt>
870 ->
decltype(
iterator(_M_t._M_upper_bound_tr(__x)))
871 {
return iterator(_M_t._M_upper_bound_tr(__x)); }
884 {
return _M_t.upper_bound(__x); }
886#if __cplusplus > 201103L
887 template<
typename _Kt>
890 ->
decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
891 {
return const_iterator(_M_t._M_upper_bound_tr(__x)); }
911 {
return _M_t.equal_range(__x); }
913#if __cplusplus > 201103L
914 template<
typename _Kt>
938 {
return _M_t.equal_range(__x); }
940#if __cplusplus > 201103L
941 template<
typename _Kt>
945 _M_t._M_equal_range_tr(__x)))
948 _M_t._M_equal_range_tr(__x));
953 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
955 operator==(
const multimap<_K1, _T1, _C1, _A1>&,
956 const multimap<_K1, _T1, _C1, _A1>&);
958 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
960 operator<(
const multimap<_K1, _T1, _C1, _A1>&,
961 const multimap<_K1, _T1, _C1, _A1>&);
974 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
978 {
return __x._M_t ==
__y._M_t; }
991 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
995 {
return __x._M_t <
__y._M_t; }
998 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1002 {
return !(__x ==
__y); }
1005 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1009 {
return __y < __x; }
1012 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1016 {
return !(
__y < __x); }
1019 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1023 {
return !(__x <
__y); }
1026 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
1033_GLIBCXX_END_NAMESPACE_CONTAINER
ISO C++ entities toplevel namespace is std.
A standard container made up of (key,value) pairs, which can be retrieved based on a key,...
void insert(initializer_list< value_type > __l)
Attempts to insert a list of std::pairs into the multimap.
multimap(const allocator_type &__a)
Allocator-extended default constructor.
multimap(multimap &&__m, const allocator_type &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())
Allocator-extended move constructor.
multimap(multimap &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Multimap move constructor.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
iterator emplace(_Args &&... __args)
Build and insert a std::pair into the multimap.
multimap() noexcept(/*conditional */)
Default constructor creates no elements.
multimap(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a multimap with no elements.
bool empty() const noexcept
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 begin() noexcept
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
iterator find(const key_type &__x)
Tries to locate an element in a multimap.
const_iterator end() const noexcept
iterator erase(const_iterator __position)
Erases an element from a multimap.
const_reverse_iterator rend() const noexcept
multimap(_InputIterator __first, _InputIterator __last, const allocator_type &__a)
Allocator-extended range constructor.
const_reverse_iterator crend() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a multimap.
multimap(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a multimap from an initializer_list.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
void swap(multimap &__x) noexcept(/*conditional */)
Swaps data with another multimap.
size_type max_size() const noexcept
const_reverse_iterator rbegin() const noexcept
const_iterator cbegin() const noexcept
key_compare key_comp() const
multimap(const multimap &__m, const allocator_type &__a)
Allocator-extended copy constructor.
reverse_iterator rend() noexcept
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Builds and inserts a std::pair into the multimap.
size_type size() const noexcept
allocator_type get_allocator() const noexcept
Get a copy of the memory allocation object.
multimap(const multimap &__x)
Multimap copy constructor.
const_reverse_iterator crbegin() const noexcept
multimap(initializer_list< value_type > __l, const allocator_type &__a)
Allocator-extended initialier-list constructor.
const_iterator cend() const noexcept
multimap(_InputIterator __first, _InputIterator __last)
Builds a multimap from a range.
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
reverse_iterator rbegin() noexcept
iterator insert(const value_type &__x)
Inserts a std::pair into the multimap.
const_iterator begin() const noexcept
multimap & operator=(multimap &&)=default
Move assignment operator.
multimap(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a multimap from a range.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
value_compare value_comp() const
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
multimap & operator=(const multimap &__x)
Multimap assignment operator.
iterator insert(const_iterator __position, const value_type &__x)
Inserts a std::pair into the multimap.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
size_type count(const key_type &__x) const
Finds the number of elements with given key.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
Uniform interface to C++98 and C++11 allocators.