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;
55 typedef _Key key_type;
56 typedef _Tp mapped_type;
58 typedef _Compare key_compare;
59 typedef _Allocator allocator_type;
60 typedef typename _Base::reference reference;
61 typedef typename _Base::const_reference const_reference;
68 typedef typename _Base::size_type size_type;
69 typedef typename _Base::difference_type difference_type;
70 typedef typename _Base::pointer pointer;
71 typedef typename _Base::const_pointer const_pointer;
76 explicit map(
const _Compare& __comp = _Compare(),
77 const _Allocator& __a = _Allocator())
78 :
_Base(__comp, __a) { }
80 template<
typename _InputIterator>
81 map(_InputIterator __first, _InputIterator __last,
82 const _Compare& __comp = _Compare(),
83 const _Allocator& __a = _Allocator())
95 #ifdef __GXX_EXPERIMENTAL_CXX0X__
98 :
_Base(std::move(__x))
102 const _Compare& __c = _Compare(),
103 const allocator_type& __a = allocator_type())
104 :
_Base(__l, __c, __a) { }
107 ~
map() _GLIBCXX_NOEXCEPT { }
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;
143 begin() _GLIBCXX_NOEXCEPT
144 {
return iterator(_Base::begin(),
this); }
147 begin()
const _GLIBCXX_NOEXCEPT
151 end() _GLIBCXX_NOEXCEPT
152 {
return iterator(_Base::end(),
this); }
155 end()
const _GLIBCXX_NOEXCEPT
159 rbegin() _GLIBCXX_NOEXCEPT
163 rbegin()
const _GLIBCXX_NOEXCEPT
167 rend() _GLIBCXX_NOEXCEPT
171 rend()
const _GLIBCXX_NOEXCEPT
174 #ifdef __GXX_EXPERIMENTAL_CXX0X__
176 cbegin()
const noexcept
180 cend()
const noexcept
184 crbegin()
const noexcept
188 crend()
const noexcept
195 using _Base::max_size;
198 using _Base::operator[];
213 #ifdef __GXX_EXPERIMENTAL_CXX0X__
214 template<
typename _Pair,
typename =
typename
216 _Pair&&>::value>::type>
221 = _Base::insert(std::forward<_Pair>(__x));
227 #ifdef __GXX_EXPERIMENTAL_CXX0X__
230 { _Base::insert(__list); }
234 #ifdef __GXX_EXPERIMENTAL_CXX0X__
241 return iterator(_Base::insert(__position.
base(), __x),
this);
244 #ifdef __GXX_EXPERIMENTAL_CXX0X__
245 template<
typename _Pair,
typename =
typename
247 _Pair&&>::value>::type>
253 std::forward<_Pair>(__x)),
this);
257 template<
typename _InputIterator>
259 insert(_InputIterator __first, _InputIterator __last)
261 __glibcxx_check_valid_range(__first, __last);
266 #ifdef __GXX_EXPERIMENTAL_CXX0X__
284 _Base::erase(__position.
base());
289 erase(
const key_type& __x)
292 if (__victim == _Base::end())
297 _Base::erase(__victim);
302 #ifdef __GXX_EXPERIMENTAL_CXX0X__
310 __victim != __last.
base(); ++__victim)
312 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
313 _M_message(__gnu_debug::__msg_valid_range)
314 ._M_iterator(__first,
"first")
315 ._M_iterator(__last,
"last"));
328 __victim != __last.
base(); ++__victim)
330 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
331 _M_message(__gnu_debug::__msg_valid_range)
332 ._M_iterator(__first,
"first")
333 ._M_iterator(__last,
"last"));
336 _Base::erase(__first.
base(), __last.
base());
348 clear() _GLIBCXX_NOEXCEPT
350 this->_M_invalidate_all();
355 using _Base::key_comp;
356 using _Base::value_comp;
360 find(
const key_type& __x)
361 {
return iterator(_Base::find(__x),
this); }
364 find(
const key_type& __x)
const
370 lower_bound(
const key_type& __x)
371 {
return iterator(_Base::lower_bound(__x),
this); }
374 lower_bound(
const key_type& __x)
const
378 upper_bound(
const key_type& __x)
379 {
return iterator(_Base::upper_bound(__x),
this); }
382 upper_bound(
const key_type& __x)
const
386 equal_range(
const key_type& __x)
389 _Base::equal_range(__x);
395 equal_range(
const key_type& __x)
const
398 _Base::equal_range(__x);
404 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
407 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
418 template<
typename _Key,
typename _Tp,
419 typename _Compare,
typename _Allocator>
423 {
return __lhs._M_base() == __rhs._M_base(); }
425 template<
typename _Key,
typename _Tp,
426 typename _Compare,
typename _Allocator>
430 {
return __lhs._M_base() != __rhs._M_base(); }
432 template<
typename _Key,
typename _Tp,
433 typename _Compare,
typename _Allocator>
435 operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
436 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
437 {
return __lhs._M_base() < __rhs._M_base(); }
439 template<
typename _Key,
typename _Tp,
440 typename _Compare,
typename _Allocator>
442 operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
443 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
444 {
return __lhs._M_base() <= __rhs._M_base(); }
446 template<
typename _Key,
typename _Tp,
447 typename _Compare,
typename _Allocator>
449 operator>=(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
450 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
451 {
return __lhs._M_base() >= __rhs._M_base(); }
453 template<
typename _Key,
typename _Tp,
454 typename _Compare,
typename _Allocator>
456 operator>(
const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
457 const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
458 {
return __lhs._M_base() > __rhs._M_base(); }
460 template<
typename _Key,
typename _Tp,
461 typename _Compare,
typename _Allocator>
463 swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
464 map<_Key, _Tp, _Compare, _Allocator>& __rhs)
465 { __lhs.swap(__rhs); }
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
_T1 first
second_type is the second bound type
_T2 second
first is a copy of the first object
#define __glibcxx_check_erase_range(_First, _Last)
void _M_swap(_Safe_sequence_base &__x)
void _M_invalidate_if(_Predicate __pred)
_Iterator base() const
Return the underlying iterator.
#define __glibcxx_check_erase(_Position)
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
Define a member typedef type only if a boolean constant is true.
size_t count() const _GLIBCXX_NOEXCEPT
Returns the number of bits which are set.
Class std::map with safety/checking/debug instrumentation.
#define __glibcxx_check_insert(_Position)
Struct holding two objects of arbitrary type.
Base class for constructing a safe sequence type that tracks iterators that reference it...
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.
is_nothrow_copy_constructible
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.