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 value_type>::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__
576 {
return _M_t._M_insert_unique_(__position, __x); }
578 #ifdef __GXX_EXPERIMENTAL_CXX0X__
579 template<
typename _Pair,
typename =
typename
581 value_type>::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