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); }
251 operator=(
const map& __x)
257 #ifdef __GXX_EXPERIMENTAL_CXX0X__
289 this->insert(__l.begin(), __l.end());
296 get_allocator()
const
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(); }
442 operator[](
const key_type& __k)
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;
499 insert(
const value_type& __x)
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); }
566 erase(iterator __position)
567 { _M_t.erase(__position); }
581 erase(
const key_type& __x)
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()); }
658 find(
const key_type& __x)
659 {
return _M_t.find(__x); }
673 find(
const key_type& __x)
const
674 {
return _M_t.find(__x); }
685 count(
const key_type& __x)
const
686 {
return _M_t.find(__x) == _M_t.end() ? 0 : 1; }
700 lower_bound(
const key_type& __x)
701 {
return _M_t.lower_bound(__x); }
715 lower_bound(
const key_type& __x)
const
716 {
return _M_t.lower_bound(__x); }
725 upper_bound(
const key_type& __x)
726 {
return _M_t.upper_bound(__x); }
735 upper_bound(
const key_type& __x)
const
736 {
return _M_t.upper_bound(__x); }
754 equal_range(
const key_type& __x)
755 {
return _M_t.equal_range(__x); }
773 equal_range(
const key_type& __x)
const
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