64 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
84 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
85 typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
89 typedef _Key key_type;
90 typedef _Tp mapped_type;
92 typedef _Compare key_compare;
93 typedef _Alloc allocator_type;
97 typedef typename _Alloc::value_type _Alloc_value_type;
98 __glibcxx_class_requires(_Tp, _SGIAssignableConcept)
99 __glibcxx_class_requires4(_Compare,
bool, _Key, _Key,
100 _BinaryFunctionConcept)
101 __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)
107 friend class map<_Key, _Tp, _Compare, _Alloc>;
111 value_compare(_Compare __c)
115 bool operator()(
const value_type& __x,
const value_type& __y)
const
121 typedef typename _Alloc::template rebind<value_type>::other
124 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,
125 key_compare, _Pair_alloc_type> _Rep_type;
133 typedef typename _Pair_alloc_type::pointer pointer;
134 typedef typename _Pair_alloc_type::const_pointer const_pointer;
135 typedef typename _Pair_alloc_type::reference reference;
136 typedef typename _Pair_alloc_type::const_reference const_reference;
137 typedef typename _Rep_type::iterator iterator;
138 typedef typename _Rep_type::const_iterator const_iterator;
139 typedef typename _Rep_type::size_type size_type;
140 typedef typename _Rep_type::difference_type difference_type;
159 map(
const _Compare& __comp,
160 const allocator_type& __a = allocator_type())
161 : _M_t(__comp, __a) { }
173 #ifdef __GXX_EXPERIMENTAL_CXX0X__
182 : _M_t(std::forward<_Rep_type>(__x._M_t)) { }
196 const _Compare& __c = _Compare(),
197 const allocator_type& __a = allocator_type())
199 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
211 template<
typename _InputIterator>
212 map(_InputIterator __first, _InputIterator __last)
214 { _M_t._M_insert_unique(__first, __last); }
227 template<
typename _InputIterator>
228 map(_InputIterator __first, _InputIterator __last,
229 const _Compare& __comp,
230 const allocator_type& __a = allocator_type())
232 { _M_t._M_insert_unique(__first, __last); }
257 #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(); }
416 {
return _M_t.empty(); }
421 {
return _M_t.size(); }
426 {
return _M_t.max_size(); }
445 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
447 iterator __i = lower_bound(__k);
449 if (__i == end() || key_comp()(__k, (*__i).first))
450 __i = insert(__i, value_type(__k, mapped_type()));
451 return (*__i).second;
464 at(
const key_type& __k)
466 iterator __i = lower_bound(__k);
467 if (__i == end() || key_comp()(__k, (*__i).first))
468 __throw_out_of_range(__N(
"map::at"));
469 return (*__i).second;
473 at(
const key_type& __k)
const
475 const_iterator __i = lower_bound(__k);
476 if (__i == end() || key_comp()(__k, (*__i).first))
477 __throw_out_of_range(__N(
"map::at"));
478 return (*__i).second;
500 {
return _M_t._M_insert_unique(__x); }
502 #ifdef __GXX_EXPERIMENTAL_CXX0X__
512 { insert (__list.begin(), __list.end()); }
539 insert(iterator __position,
const value_type& __x)
540 {
return _M_t._M_insert_unique_(__position, __x); }
550 template<
typename _InputIterator>
552 insert(_InputIterator __first, _InputIterator __last)
553 { _M_t._M_insert_unique(__first, __last); }
567 { _M_t.erase(__position); }
582 {
return _M_t.erase(__x); }
596 erase(iterator __first, iterator __last)
597 { _M_t.erase(__first, __last); }
611 #ifdef __GXX_EXPERIMENTAL_CXX0X__
616 { _M_t.swap(__x._M_t); }
635 {
return _M_t.key_comp(); }
643 {
return value_compare(_M_t.key_comp()); }
659 {
return _M_t.find(__x); }
673 find(
const key_type& __x)
const
674 {
return _M_t.find(__x); }
686 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
701 {
return _M_t.lower_bound(__x); }
716 {
return _M_t.lower_bound(__x); }
726 {
return _M_t.upper_bound(__x); }
736 {
return _M_t.upper_bound(__x); }
755 {
return _M_t.equal_range(__x); }
774 {
return _M_t.equal_range(__x); }
776 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
781 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
783 operator<(const map<_K1, _T1, _C1, _A1>&,
797 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
801 {
return __x._M_t == __y._M_t; }
814 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
816 operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
818 {
return __x._M_t < __y._M_t; }
821 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
825 {
return !(__x == __y); }
828 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
832 {
return __y < __x; }
835 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
837 operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
839 {
return !(__y < __x); }
842 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
846 {
return !(__x < __y); }
849 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
855 #ifdef __GXX_EXPERIMENTAL_CXX0X__
856 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
858 swap(map<_Key, _Tp, _Compare, _Alloc>&& __x,
859 map<_Key, _Tp, _Compare, _Alloc>& __y)
862 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
864 swap(map<_Key, _Tp, _Compare, _Alloc>& __x,
865 map<_Key, _Tp, _Compare, _Alloc>&& __y)
869 _GLIBCXX_END_NESTED_NAMESPACE
reverse_iterator rbegin()
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to map data.
pair holds two objects of arbitrary type.
map()
Default constructor creates no elements.
iterator find(const key_type &__x)
Tries to locate an element in a map.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
map & operator=(initializer_list< value_type > __l)
Map list assignment operator.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the map.
const_iterator begin() const
bool operator>=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
bool operator==(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Map equality comparison.
iterator insert(iterator __position, const value_type &__x)
Attempts to insert a std::pair into the map.
void insert(std::initializer_list< value_type > __list)
Attempts to insert a list of std::pairs into the map.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
map & operator=(map &&__x)
Map move assignment operator.
const_iterator lower_bound(const key_type &__x) const
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.
map & operator=(const map &__x)
Map assignment operator.
_T1 first
first is a copy of the first object
const_reverse_iterator crend() const
key_compare key_comp() const
map(_InputIterator __first, _InputIterator __last)
Builds a map from a range.
const_iterator find(const key_type &__x) const
Tries to locate an element in a map.
const_reverse_iterator crbegin() const
bool operator>(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
const_iterator cend() const
value_compare value_comp() const
size_type count(const key_type &__x) const
Finds the number of elements with given key.
map(map &&__x)
Map move constructor.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
void insert(_InputIterator __first, _InputIterator __last)
Template function that attempts to insert a range of elements.
mapped_type & at(const key_type &__k)
Access to map data.
void erase(iterator __position)
Erases an element from a map.
const_reverse_iterator rbegin() const
map(initializer_list< value_type > __l, const _Compare &__c=_Compare(), const allocator_type &__a=allocator_type())
Builds a map from an initializer_list.
map(const map &__x)
Map copy constructor.
allocator_type get_allocator() const
Get a copy of the memory allocation object.
const_reverse_iterator rend() const
const_iterator end() const
bool operator!=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator==.
map(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a map with no elements.
size_type max_size() const
void erase(iterator __first, iterator __last)
Erases a [first,last) range of elements from a map.
map(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a map from a range.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
const_iterator cbegin() const
void swap(map &&__x)
Swaps data with another map.