30 #ifndef _GLIBCXX_DEBUG_MAP_H
31 #define _GLIBCXX_DEBUG_MAP_H 1
37 namespace std _GLIBCXX_VISIBILITY(default)
42 template<
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
43 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
45 :
public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>,
48 typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>
_Base;
56 typedef _Key key_type;
57 typedef _Tp mapped_type;
59 typedef _Compare key_compare;
60 typedef _Allocator allocator_type;
61 typedef typename _Base::reference reference;
62 typedef typename _Base::const_reference const_reference;
69 typedef typename _Base::size_type size_type;
70 typedef typename _Base::difference_type difference_type;
71 typedef typename _Base::pointer pointer;
72 typedef typename _Base::const_pointer const_pointer;
77 explicit map(
const _Compare& __comp = _Compare(),
78 const _Allocator& __a = _Allocator())
79 :
_Base(__comp, __a) { }
81 template<
typename _InputIterator>
82 map(_InputIterator __first, _InputIterator __last,
83 const _Compare& __comp = _Compare(),
84 const _Allocator& __a = _Allocator())
96 #ifdef __GXX_EXPERIMENTAL_CXX0X__
102 const _Compare& __c = _Compare(),
103 const allocator_type& __a = allocator_type())
110 operator=(
const map& __x)
112 *
static_cast<_Base*
>(
this) = __x;
113 this->_M_invalidate_all();
117 #ifdef __GXX_EXPERIMENTAL_CXX0X__
139 using _Base::get_allocator;
144 {
return iterator(_Base::begin(),
this); }
152 {
return iterator(_Base::end(),
this); }
174 #ifdef __GXX_EXPERIMENTAL_CXX0X__
195 using _Base::max_size;
198 using _Base::operator[];
214 #ifdef __GXX_EXPERIMENTAL_CXX0X__
215 template<
typename _Pair,
typename =
typename
223 = _Base::insert(std::forward<_Pair>(__x));
229 #ifdef __GXX_EXPERIMENTAL_CXX0X__
232 { _Base::insert(__list); }
236 #ifdef __GXX_EXPERIMENTAL_CXX0X__
243 return iterator(_Base::insert(__position.
base(), __x),
this);
246 #ifdef __GXX_EXPERIMENTAL_CXX0X__
247 template<
typename _Pair,
typename =
typename
255 std::forward<_Pair>(__x)),
this);
259 template<
typename _InputIterator>
261 insert(_InputIterator __first, _InputIterator __last)
263 __glibcxx_check_valid_range(__first, __last);
268 #ifdef __GXX_EXPERIMENTAL_CXX0X__
286 _Base::erase(__position.
base());
291 erase(
const key_type& __x)
294 if (__victim == _Base::end())
299 _Base::erase(__victim);
304 #ifdef __GXX_EXPERIMENTAL_CXX0X__
312 __victim != __last.
base(); ++__victim)
315 _M_message(__gnu_debug::__msg_valid_range)
316 ._M_iterator(__first,
"first")
317 ._M_iterator(__last,
"last"));
330 __victim != __last.
base(); ++__victim)
333 _M_message(__gnu_debug::__msg_valid_range)
334 ._M_iterator(__first,
"first")
335 ._M_iterator(__last,
"last"));
338 _Base::erase(__first.
base(), __last.
base());
352 this->_M_invalidate_all();
357 using _Base::key_comp;
358 using _Base::value_comp;
362 find(
const key_type& __x)
363 {
return iterator(_Base::find(__x),
this); }
366 find(
const key_type& __x)
const
372 lower_bound(
const key_type& __x)
373 {
return iterator(_Base::lower_bound(__x),
this); }
376 lower_bound(
const key_type& __x)
const
380 upper_bound(
const key_type& __x)
381 {
return iterator(_Base::upper_bound(__x),
this); }
384 upper_bound(
const key_type& __x)
const
388 equal_range(
const key_type& __x)
392 _Base::equal_range(__x);
398 equal_range(
const key_type& __x)
const
402 _Base::equal_range(__x);
408 _M_base() {
return *
this; }
411 _M_base()
const {
return *
this; }
423 template<
typename _Key,
typename _Tp,
424 typename _Compare,
typename _Allocator>
428 {
return __lhs._M_base() == __rhs._M_base(); }
430 template<
typename _Key,
typename _Tp,
431 typename _Compare,
typename _Allocator>
435 {
return __lhs._M_base() != __rhs._M_base(); }
437 template<
typename _Key,
typename _Tp,
438 typename _Compare,
typename _Allocator>
440 operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
441 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
442 {
return __lhs._M_base() < __rhs._M_base(); }
444 template<
typename _Key,
typename _Tp,
445 typename _Compare,
typename _Allocator>
447 operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
448 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
449 {
return __lhs._M_base() <= __rhs._M_base(); }
451 template<
typename _Key,
typename _Tp,
452 typename _Compare,
typename _Allocator>
454 operator>=(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
455 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
456 {
return __lhs._M_base() >= __rhs._M_base(); }
458 template<
typename _Key,
typename _Tp,
459 typename _Compare,
typename _Allocator>
461 operator>(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
462 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
463 {
return __lhs._M_base() > __rhs._M_base(); }
465 template<
typename _Key,
typename _Tp,
466 typename _Compare,
typename _Allocator>
468 swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
469 map<_Key, _Tp, _Compare, _Allocator>& __rhs)
470 { __lhs.swap(__rhs); }