64 namespace std _GLIBCXX_VISIBILITY(default)
66 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
86 template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
87 typename _Alloc = std::allocator<std::pair<const _Key, _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 map<_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;
135 typedef typename _Pair_alloc_type::pointer pointer;
136 typedef typename _Pair_alloc_type::const_pointer const_pointer;
137 typedef typename _Pair_alloc_type::reference reference;
138 typedef typename _Pair_alloc_type::const_reference const_reference;
139 typedef typename _Rep_type::iterator iterator;
140 typedef typename _Rep_type::const_iterator const_iterator;
141 typedef typename _Rep_type::size_type size_type;
142 typedef typename _Rep_type::difference_type difference_type;
161 map(
const _Compare& __comp,
162 const allocator_type& __a = allocator_type())
163 : _M_t(__comp, __a) { }
175 #ifdef __GXX_EXPERIMENTAL_CXX0X__
184 : _M_t(std::move(__x._M_t)) { }
198 const _Compare& __c = _Compare(),
199 const allocator_type& __a = allocator_type())
201 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
213 template<
typename _InputIterator>
214 map(_InputIterator __first, _InputIterator __last)
216 { _M_t._M_insert_unique(__first, __last); }
229 template<
typename _InputIterator>
230 map(_InputIterator __first, _InputIterator __last,
231 const _Compare& __comp,
232 const allocator_type& __a = allocator_type())
234 { _M_t._M_insert_unique(__first, __last); }
259 #ifdef __GXX_EXPERIMENTAL_CXX0X__
292 this->
insert(__l.begin(), __l.end());
300 {
return _M_t.get_allocator(); }
310 {
return _M_t.begin(); }
319 {
return _M_t.begin(); }
328 {
return _M_t.end(); }
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(); }
419 {
return _M_t.empty(); }
424 {
return _M_t.size(); }
429 {
return _M_t.max_size(); }
448 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
454 return (*__i).second;
457 #ifdef __GXX_EXPERIMENTAL_CXX0X__
462 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
468 return (*__i).second;
482 at(
const key_type& __k)
486 __throw_out_of_range(__N(
"map::at"));
487 return (*__i).second;
491 at(
const key_type& __k)
const
495 __throw_out_of_range(__N(
"map::at"));
496 return (*__i).second;
518 {
return _M_t._M_insert_unique(__x); }
520 #ifdef __GXX_EXPERIMENTAL_CXX0X__
521 template<
typename _Pair,
typename =
typename
523 value_type>::value>::type>
526 {
return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
529 #ifdef __GXX_EXPERIMENTAL_CXX0X__
539 {
insert(__list.begin(), __list.end()); }
566 #ifdef __GXX_EXPERIMENTAL_CXX0X__
571 {
return _M_t._M_insert_unique_(__position, __x); }
573 #ifdef __GXX_EXPERIMENTAL_CXX0X__
574 template<
typename _Pair,
typename =
typename
576 value_type>::value>::type>
578 insert(const_iterator __position, _Pair&& __x)
579 {
return _M_t._M_insert_unique_(__position,
580 std::forward<_Pair>(__x)); }
591 template<
typename _InputIterator>
593 insert(_InputIterator __first, _InputIterator __last)
594 { _M_t._M_insert_unique(__first, __last); }
596 #ifdef __GXX_EXPERIMENTAL_CXX0X__
614 {
return _M_t.erase(__position); }
619 {
return _M_t.erase(__position); }
632 erase(iterator __position)
633 { _M_t.erase(__position); }
649 {
return _M_t.erase(__x); }
651 #ifdef __GXX_EXPERIMENTAL_CXX0X__
667 erase(const_iterator __first, const_iterator __last)
668 {
return _M_t.erase(__first, __last); }
683 { _M_t.erase(__first, __last); }
699 { _M_t.swap(__x._M_t); }
718 {
return _M_t.key_comp(); }
726 {
return value_compare(_M_t.key_comp()); }
742 {
return _M_t.find(__x); }
756 find(
const key_type& __x)
const
757 {
return _M_t.find(__x); }
769 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
784 {
return _M_t.lower_bound(__x); }
799 {
return _M_t.lower_bound(__x); }
809 {
return _M_t.upper_bound(__x); }
819 {
return _M_t.upper_bound(__x); }
838 {
return _M_t.equal_range(__x); }
857 {
return _M_t.equal_range(__x); }
859 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
864 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
866 operator<(const map<_K1, _T1, _C1, _A1>&,
880 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
884 {
return __x._M_t == __y._M_t; }
897 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
899 operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
901 {
return __x._M_t < __y._M_t; }
904 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
908 {
return !(__x == __y); }
911 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
915 {
return __y < __x; }
918 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
920 operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
922 {
return !(__y < __x); }
925 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
929 {
return !(__x < __y); }
932 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
938 _GLIBCXX_END_NAMESPACE_CONTAINER
map(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a map from a range.
map & operator=(map &&__x)
Map move assignment operator.
key_compare key_comp() const
map(_InputIterator __first, _InputIterator __last)
Builds a map from a range.
const_iterator cend() const
Struct holding two objects of arbitrary type.
_T1 first
second_type is the second bound type
size_type count(const key_type &__x) const
Finds the number of elements with given key.
const_iterator begin() const
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a map.
void swap(map &__x)
Swaps data with another map.
map()
Default constructor creates no elements.
bool operator>=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
map(const map &__x)
Map copy constructor.
map(initializer_list< value_type > __l, const _Compare &__c=_Compare(), const allocator_type &__a=allocator_type())
Builds a map from an initializer_list.
bool operator>(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to map data.
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
const_reverse_iterator crbegin() const
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert a std::pair into the map.
const_iterator cbegin() const
void insert(_InputIterator __first, _InputIterator __last)
Template function that attempts to insert a range of elements.
map(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a map with no elements.
map & operator=(initializer_list< value_type > __l)
Map list assignment operator.
size_type max_size() const
allocator_type get_allocator() const
Get a copy of the memory allocation object.
bool operator!=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator==.
const_reverse_iterator crend() const
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the map.
value_compare value_comp() const
iterator find(const key_type &__x)
Tries to locate an element in a map.
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
reverse_iterator rbegin()
iterator erase(const_iterator __position)
Erases an element from a map.
const_iterator end() const
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
const_iterator find(const key_type &__x) const
Tries to locate an element in a map.
map(map &&__x)
Map move constructor.
bool operator==(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Map equality comparison.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
map & operator=(const map &__x)
Map assignment operator.
mapped_type & at(const key_type &__k)
Access to map data.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
const_reverse_iterator rbegin() const
const_reverse_iterator rend() const
void insert(std::initializer_list< value_type > __list)
Attempts to insert a list of std::pairs into the map.