46 map<_Key, _Tp, _Compare, _Allocator>, _Allocator,
47 __gnu_debug::_Safe_node_sequence>,
48 public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator>
50 typedef _GLIBCXX_STD_C::map<
51 _Key, _Tp, _Compare, _Allocator> _Base;
55 typedef typename _Base::const_iterator _Base_const_iterator;
56 typedef typename _Base::iterator _Base_iterator;
59 template<
typename _ItT,
typename _SeqT,
typename _CatT>
60 friend class ::__gnu_debug::_Safe_iterator;
67 _Base_ref(
const _Base& __r) : _M_ref(__r) { }
74 typedef _Key key_type;
75 typedef _Tp mapped_type;
77 typedef _Compare key_compare;
78 typedef _Allocator allocator_type;
79 typedef typename _Base::reference reference;
80 typedef typename _Base::const_reference const_reference;
87 typedef typename _Base::size_type size_type;
88 typedef typename _Base::difference_type difference_type;
89 typedef typename _Base::pointer pointer;
90 typedef typename _Base::const_pointer const_pointer;
96#if __cplusplus < 201103L
105 map(
const map&) =
default;
106 map(map&&) =
default;
109 const _Compare& __c = _Compare(),
110 const allocator_type& __a = allocator_type())
111 : _Base(__l, __c, __a) { }
114 map(
const allocator_type& __a)
117 map(
const map& __m,
const allocator_type& __a)
118 : _Base(__m, __a) { }
120 map(map&& __m,
const allocator_type& __a)
121 noexcept(
noexcept(_Base(
std::move(__m._M_base()), __a)) )
126 : _Base(__l, __a) { }
128 template<
typename _InputIterator>
129 map(_InputIterator __first, _InputIterator __last,
130 const allocator_type& __a)
132 __glibcxx_check_valid_constructor_range(__first, __last)),
140 : _Base(__x._M_ref) { }
142 explicit map(
const _Compare& __comp,
143 const _Allocator& __a = _Allocator())
144 : _Base(__comp, __a) { }
146 template<
typename _InputIterator>
147 map(_InputIterator __first, _InputIterator __last,
148 const _Compare& __comp = _Compare(),
149 const _Allocator& __a = _Allocator())
151 __glibcxx_check_valid_constructor_range(__first, __last)),
155#if __cplusplus < 201103L
157 operator=(
const map& __x)
159 this->_M_safe() = __x;
165 operator=(
const map&) =
default;
168 operator=(map&&) =
default;
174 this->_M_invalidate_all();
181 using _Base::get_allocator;
185 begin() _GLIBCXX_NOEXCEPT
186 {
return iterator(_Base::begin(),
this); }
189 begin()
const _GLIBCXX_NOEXCEPT
190 {
return const_iterator(_Base::begin(),
this); }
193 end() _GLIBCXX_NOEXCEPT
194 {
return iterator(_Base::end(),
this); }
197 end()
const _GLIBCXX_NOEXCEPT
198 {
return const_iterator(_Base::end(),
this); }
201 rbegin() _GLIBCXX_NOEXCEPT
202 {
return reverse_iterator(end()); }
204 const_reverse_iterator
205 rbegin()
const _GLIBCXX_NOEXCEPT
206 {
return const_reverse_iterator(end()); }
209 rend() _GLIBCXX_NOEXCEPT
210 {
return reverse_iterator(begin()); }
212 const_reverse_iterator
213 rend()
const _GLIBCXX_NOEXCEPT
214 {
return const_reverse_iterator(begin()); }
216#if __cplusplus >= 201103L
218 cbegin()
const noexcept
219 {
return const_iterator(_Base::begin(),
this); }
222 cend()
const noexcept
223 {
return const_iterator(_Base::end(),
this); }
225 const_reverse_iterator
226 crbegin()
const noexcept
227 {
return const_reverse_iterator(end()); }
229 const_reverse_iterator
230 crend()
const noexcept
231 {
return const_reverse_iterator(begin()); }
237 using _Base::max_size;
240 using _Base::operator[];
247#if __cplusplus >= 201103L
248 template<
typename... _Args>
250 emplace(_Args&&... __args)
253 return { { __res.first,
this }, __res.second };
256 template<
typename... _Args>
258 emplace_hint(const_iterator __pos, _Args&&... __args)
270 insert(
const value_type& __x)
277#if __cplusplus >= 201103L
281 insert(value_type&& __x)
283 auto __res = _Base::insert(
std::move(__x));
284 return { { __res.first,
this }, __res.second };
287 template<
typename _Pair,
typename =
typename
294 return { { __res.first,
this }, __res.second };
298#if __cplusplus >= 201103L
301 { _Base::insert(__list); }
305#if __cplusplus >= 201103L
306 insert(const_iterator __position,
const value_type& __x)
308 insert(iterator __position,
const value_type& __x)
312 return iterator(_Base::insert(__position.
base(), __x),
this);
315#if __cplusplus >= 201103L
319 insert(const_iterator __position, value_type&& __x)
322 return { _Base::insert(__position.
base(),
std::move(__x)),
this };
325 template<
typename _Pair,
typename =
typename
329 insert(const_iterator __position, _Pair&& __x)
340 template<
typename _InputIterator>
342 insert(_InputIterator __first, _InputIterator __last)
344 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
345 __glibcxx_check_valid_range2(__first, __last, __dist);
347 if (__dist.second >= __gnu_debug::__dp_sign)
348 _Base::insert(__gnu_debug::__unsafe(__first),
349 __gnu_debug::__unsafe(__last));
351 _Base::insert(__first, __last);
355#if __cplusplus > 201402L
356 template <
typename... _Args>
358 try_emplace(
const key_type& __k, _Args&&... __args)
360 auto __res = _Base::try_emplace(__k,
362 return { { __res.first,
this }, __res.second };
365 template <
typename... _Args>
367 try_emplace(key_type&& __k, _Args&&... __args)
369 auto __res = _Base::try_emplace(
std::move(__k),
371 return { { __res.first,
this }, __res.second };
374 template <
typename... _Args>
376 try_emplace(const_iterator __hint,
const key_type& __k,
382 _Base::try_emplace(__hint.
base(), __k,
388 template <
typename... _Args>
390 try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args)
401 template <
typename _Obj>
403 insert_or_assign(
const key_type& __k, _Obj&& __obj)
405 auto __res = _Base::insert_or_assign(__k,
407 return { { __res.first,
this }, __res.second };
410 template <
typename _Obj>
412 insert_or_assign(key_type&& __k, _Obj&& __obj)
414 auto __res = _Base::insert_or_assign(
std::move(__k),
416 return { { __res.first,
this }, __res.second };
419 template <
typename _Obj>
421 insert_or_assign(const_iterator __hint,
422 const key_type& __k, _Obj&& __obj)
427 _Base::insert_or_assign(__hint.
base(), __k,
433 template <
typename _Obj>
435 insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj)
447#if __cplusplus > 201402L
448 using node_type =
typename _Base::node_type;
452 extract(const_iterator __position)
455 this->_M_invalidate_if(_Equal(__position.
base()));
456 return _Base::extract(__position.
base());
460 extract(
const key_type& __key)
462 const auto __position = find(__key);
463 if (__position != end())
464 return extract(__position);
469 insert(node_type&& __nh)
471 auto __ret = _Base::insert(
std::move(__nh));
473 { { __ret.position,
this }, __ret.inserted,
std::move(__ret.node) };
477 insert(const_iterator __hint, node_type&& __nh)
480 return { _Base::insert(__hint.
base(),
std::move(__nh)),
this };
486#if __cplusplus >= 201103L
488 erase(const_iterator __position)
491 this->_M_invalidate_if(_Equal(__position.
base()));
492 return { _Base::erase(__position.
base()),
this };
495 _GLIBCXX_ABI_TAG_CXX11
497 erase(iterator __position)
498 {
return erase(const_iterator(__position)); }
501 erase(iterator __position)
504 this->_M_invalidate_if(_Equal(__position.
base()));
505 _Base::erase(__position.
base());
510 erase(
const key_type& __x)
512 _Base_iterator __victim = _Base::find(__x);
513 if (__victim == _Base::end())
517 this->_M_invalidate_if(_Equal(__victim));
518 _Base::erase(__victim);
523#if __cplusplus >= 201103L
525 erase(const_iterator __first, const_iterator __last)
530 for (_Base_const_iterator __victim = __first.base();
531 __victim != __last.
base(); ++__victim)
533 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
534 _M_message(__gnu_debug::__msg_valid_range)
535 ._M_iterator(__first,
"first")
536 ._M_iterator(__last,
"last"));
537 this->_M_invalidate_if(_Equal(__victim));
540 return { _Base::erase(__first.base(), __last.
base()),
this };
544 erase(iterator __first, iterator __last)
549 for (_Base_iterator __victim = __first.base();
550 __victim != __last.
base(); ++__victim)
552 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
553 _M_message(__gnu_debug::__msg_valid_range)
554 ._M_iterator(__first,
"first")
555 ._M_iterator(__last,
"last"));
556 this->_M_invalidate_if(_Equal(__victim));
558 _Base::erase(__first.base(), __last.
base());
571 clear() _GLIBCXX_NOEXCEPT
573 this->_M_invalidate_all();
578 using _Base::key_comp;
579 using _Base::value_comp;
583 find(
const key_type& __x)
584 {
return iterator(_Base::find(__x),
this); }
586#if __cplusplus > 201103L
587 template<
typename _Kt,
589 typename __has_is_transparent<_Compare, _Kt>::type>
592 {
return { _Base::find(__x),
this }; }
596 find(
const key_type& __x)
const
597 {
return const_iterator(_Base::find(__x),
this); }
599#if __cplusplus > 201103L
600 template<
typename _Kt,
602 typename __has_is_transparent<_Compare, _Kt>::type>
604 find(
const _Kt& __x)
const
605 {
return { _Base::find(__x),
this }; }
611 lower_bound(
const key_type& __x)
612 {
return iterator(_Base::lower_bound(__x),
this); }
614#if __cplusplus > 201103L
615 template<
typename _Kt,
617 typename __has_is_transparent<_Compare, _Kt>::type>
619 lower_bound(
const _Kt& __x)
620 {
return { _Base::lower_bound(__x),
this }; }
624 lower_bound(
const key_type& __x)
const
625 {
return const_iterator(_Base::lower_bound(__x),
this); }
627#if __cplusplus > 201103L
628 template<
typename _Kt,
630 typename __has_is_transparent<_Compare, _Kt>::type>
632 lower_bound(
const _Kt& __x)
const
633 {
return { _Base::lower_bound(__x),
this }; }
637 upper_bound(
const key_type& __x)
638 {
return iterator(_Base::upper_bound(__x),
this); }
640#if __cplusplus > 201103L
641 template<
typename _Kt,
643 typename __has_is_transparent<_Compare, _Kt>::type>
645 upper_bound(
const _Kt& __x)
646 {
return { _Base::upper_bound(__x),
this }; }
650 upper_bound(
const key_type& __x)
const
651 {
return const_iterator(_Base::upper_bound(__x),
this); }
653#if __cplusplus > 201103L
654 template<
typename _Kt,
656 typename __has_is_transparent<_Compare, _Kt>::type>
658 upper_bound(
const _Kt& __x)
const
659 {
return { _Base::upper_bound(__x),
this }; }
663 equal_range(
const key_type& __x)
666 _Base::equal_range(__x);
668 iterator(__res.
second,
this));
671#if __cplusplus > 201103L
672 template<
typename _Kt,
674 typename __has_is_transparent<_Compare, _Kt>::type>
676 equal_range(
const _Kt& __x)
678 auto __res = _Base::equal_range(__x);
679 return { { __res.first,
this }, { __res.second,
this } };
684 equal_range(
const key_type& __x)
const
687 _Base::equal_range(__x);
689 const_iterator(__res.
second,
this));
692#if __cplusplus > 201103L
693 template<
typename _Kt,
695 typename __has_is_transparent<_Compare, _Kt>::type>
697 equal_range(
const _Kt& __x)
const
699 auto __res = _Base::equal_range(__x);
700 return { { __res.first,
this }, { __res.second,
this } };
705 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
708 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }