62 #ifdef __GXX_EXPERIMENTAL_CXX0X__
66 namespace std _GLIBCXX_VISIBILITY(default)
68 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
88 template <
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
89 typename _Alloc = std::allocator<std::pair<const _Key, _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 map<_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;
137 typedef typename _Pair_alloc_type::pointer pointer;
138 typedef typename _Pair_alloc_type::const_pointer const_pointer;
139 typedef typename _Pair_alloc_type::reference reference;
140 typedef typename _Pair_alloc_type::const_reference const_reference;
141 typedef typename _Rep_type::iterator iterator;
142 typedef typename _Rep_type::const_iterator const_iterator;
143 typedef typename _Rep_type::size_type size_type;
144 typedef typename _Rep_type::difference_type difference_type;
163 map(
const _Compare& __comp,
164 const allocator_type& __a = allocator_type())
165 : _M_t(__comp, _Pair_alloc_type(__a)) { }
177 #ifdef __GXX_EXPERIMENTAL_CXX0X__
187 : _M_t(std::move(__x._M_t)) { }
201 const _Compare& __comp = _Compare(),
202 const allocator_type& __a = allocator_type())
203 : _M_t(__comp, _Pair_alloc_type(__a))
204 { _M_t._M_insert_unique(__l.begin(), __l.end()); }
217 template<
typename _InputIterator>
218 map(_InputIterator __first, _InputIterator __last)
220 { _M_t._M_insert_unique(__first, __last); }
234 template<
typename _InputIterator>
235 map(_InputIterator __first, _InputIterator __last,
236 const _Compare& __comp,
237 const allocator_type& __a = allocator_type())
238 : _M_t(__comp, _Pair_alloc_type(__a))
239 { _M_t._M_insert_unique(__first, __last); }
264 #ifdef __GXX_EXPERIMENTAL_CXX0X__
297 this->
insert(__l.begin(), __l.end());
305 {
return allocator_type(_M_t.get_allocator()); }
315 {
return _M_t.begin(); }
324 {
return _M_t.begin(); }
333 {
return _M_t.end(); }
341 end() const _GLIBCXX_NOEXCEPT
342 {
return _M_t.end(); }
351 {
return _M_t.rbegin(); }
358 const_reverse_iterator
360 {
return _M_t.rbegin(); }
369 {
return _M_t.rend(); }
376 const_reverse_iterator
378 {
return _M_t.rend(); }
380 #ifdef __GXX_EXPERIMENTAL_CXX0X__
388 {
return _M_t.begin(); }
397 {
return _M_t.end(); }
404 const_reverse_iterator
406 {
return _M_t.rbegin(); }
413 const_reverse_iterator
415 {
return _M_t.rend(); }
424 {
return _M_t.empty(); }
429 {
return _M_t.size(); }
434 {
return _M_t.max_size(); }
453 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
459 return (*__i).second;
462 #ifdef __GXX_EXPERIMENTAL_CXX0X__
467 __glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)
473 return (*__i).second;
487 at(
const key_type& __k)
491 __throw_out_of_range(__N(
"map::at"));
492 return (*__i).second;
496 at(
const key_type& __k)
const
500 __throw_out_of_range(__N(
"map::at"));
501 return (*__i).second;
523 {
return _M_t._M_insert_unique(__x); }
525 #ifdef __GXX_EXPERIMENTAL_CXX0X__
526 template<
typename _Pair,
typename =
typename
528 _Pair&&>::value>::type>
531 {
return _M_t._M_insert_unique(std::forward<_Pair>(__x)); }
534 #ifdef __GXX_EXPERIMENTAL_CXX0X__
544 {
insert(__list.begin(), __list.end()); }
571 #ifdef __GXX_EXPERIMENTAL_CXX0X__
572 insert(const_iterator __position,
const value_type& __x)
574 insert(iterator __position,
const value_type& __x)
576 {
return _M_t._M_insert_unique_(__position, __x); }
578 #ifdef __GXX_EXPERIMENTAL_CXX0X__
579 template<
typename _Pair,
typename =
typename
581 _Pair&&>::value>::type>
583 insert(const_iterator __position, _Pair&& __x)
584 {
return _M_t._M_insert_unique_(__position,
585 std::forward<_Pair>(__x)); }
596 template<
typename _InputIterator>
598 insert(_InputIterator __first, _InputIterator __last)
599 { _M_t._M_insert_unique(__first, __last); }
601 #ifdef __GXX_EXPERIMENTAL_CXX0X__
619 {
return _M_t.erase(__position); }
624 {
return _M_t.erase(__position); }
637 erase(iterator __position)
638 { _M_t.erase(__position); }
654 {
return _M_t.erase(__x); }
656 #ifdef __GXX_EXPERIMENTAL_CXX0X__
673 erase(const_iterator __first, const_iterator __last)
674 {
return _M_t.erase(__first, __last); }
690 { _M_t.erase(__first, __last); }
706 { _M_t.swap(__x._M_t); }
725 {
return _M_t.key_comp(); }
733 {
return value_compare(_M_t.key_comp()); }
749 {
return _M_t.find(__x); }
763 find(
const key_type& __x)
const
764 {
return _M_t.find(__x); }
776 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
791 {
return _M_t.lower_bound(__x); }
806 {
return _M_t.lower_bound(__x); }
816 {
return _M_t.upper_bound(__x); }
826 {
return _M_t.upper_bound(__x); }
845 {
return _M_t.equal_range(__x); }
864 {
return _M_t.equal_range(__x); }
866 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
871 template<
typename _K1,
typename _T1,
typename _C1,
typename _A1>
873 operator<(const map<_K1, _T1, _C1, _A1>&,
887 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
891 {
return __x._M_t == __y._M_t; }
904 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
906 operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,
908 {
return __x._M_t < __y._M_t; }
911 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
915 {
return !(__x == __y); }
918 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
922 {
return __y < __x; }
925 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
927 operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,
929 {
return !(__y < __x); }
932 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
936 {
return !(__x < __y); }
939 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
945 _GLIBCXX_END_NAMESPACE_CONTAINER
const_iterator begin() const _GLIBCXX_NOEXCEPT
_T1 first
second_type is the second bound type
reverse_iterator rbegin() _GLIBCXX_NOEXCEPT
map(map &&__x) noexcept(is_nothrow_copy_constructible< _Compare >::value)
Map move constructor.
iterator insert(const_iterator __position, const value_type &__x)
Attempts to insert a std::pair into the map.
const_iterator end() const _GLIBCXX_NOEXCEPT
iterator end() _GLIBCXX_NOEXCEPT
iterator find(const key_type &__x)
Tries to locate an element in a map.
value_compare value_comp() const
size_type max_size() const _GLIBCXX_NOEXCEPT
iterator upper_bound(const key_type &__x)
Finds the end of a subsequence matching given key.
const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT
size_type count(const key_type &__x) const
Finds the number of elements with given key.
map(const _Compare &__comp, const allocator_type &__a=allocator_type())
Creates a map with no elements.
iterator erase(const_iterator __position)
Erases an element from a map.
const_iterator cbegin() const noexcept
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
void clear() _GLIBCXX_NOEXCEPT
bool operator==(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Map equality comparison.
Define a member typedef type only if a boolean constant is true.
bool empty() const _GLIBCXX_NOEXCEPT
reverse_iterator rend() _GLIBCXX_NOEXCEPT
iterator lower_bound(const key_type &__x)
Finds the beginning of a subsequence matching given key.
bool operator>(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
allocator_type get_allocator() const _GLIBCXX_NOEXCEPT
Get a copy of the memory allocation object.
void swap(map &__x)
Swaps data with another map.
const_reverse_iterator crend() const noexcept
map(_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())
Builds a map from a range.
const_iterator find(const key_type &__x) const
Tries to locate an element in a map.
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.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
map()
Default constructor creates no elements.
map & operator=(initializer_list< value_type > __l)
Map list assignment operator.
map(_InputIterator __first, _InputIterator __last)
Builds a map from a range.
const_reverse_iterator crbegin() const noexcept
bool operator!=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator==.
iterator begin() _GLIBCXX_NOEXCEPT
bool operator>=(const map< _Key, _Tp, _Compare, _Alloc > &__x, const map< _Key, _Tp, _Compare, _Alloc > &__y)
Based on operator<.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [first,last) range of elements from a map.
const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT
Struct holding two objects of arbitrary type.
map(initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
Builds a map from an initializer_list.
void insert(std::initializer_list< value_type > __list)
Attempts to insert a list of std::pairs into the map.
void insert(_InputIterator __first, _InputIterator __last)
Template function that attempts to insert a range of elements.
key_compare key_comp() const
const_iterator upper_bound(const key_type &__x) const
Finds the end of a subsequence matching given key.
map(const map &__x)
Map copy constructor.
mapped_type & at(const key_type &__k)
Access to map data.
mapped_type & operator[](const key_type &__k)
Subscript ( [] ) access to map data.
constexpr 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.
size_type size() const _GLIBCXX_NOEXCEPT
is_nothrow_copy_constructible
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert a std::pair into the map.
map & operator=(map &&__x)
Map move assignment operator.
const_iterator cend() const noexcept
const_iterator lower_bound(const key_type &__x) const
Finds the beginning of a subsequence matching given key.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.