46 multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator,
47 __gnu_debug::_Safe_node_sequence>,
48 public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
50 typedef _GLIBCXX_STD_C::multimap<
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;
85 multimap> const_iterator;
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
97 multimap() : _Base() { }
99 multimap(
const multimap& __x)
104 multimap() =
default;
105 multimap(
const multimap&) =
default;
106 multimap(multimap&&) =
default;
109 const _Compare& __c = _Compare(),
110 const allocator_type& __a = allocator_type())
111 : _Base(__l, __c, __a) { }
114 multimap(
const allocator_type& __a)
117 multimap(
const multimap& __m,
const allocator_type& __a)
118 : _Base(__m, __a) { }
120 multimap(multimap&& __m,
const allocator_type& __a)
121 noexcept(
noexcept(_Base(
std::move(__m._M_base()), __a)) )
126 : _Base(__l, __a) { }
128 template<
typename _InputIterator>
129 multimap(_InputIterator __first, _InputIterator __last,
130 const allocator_type& __a)
132 __glibcxx_check_valid_constructor_range(__first, __last)),
135 ~multimap() =
default;
138 explicit multimap(
const _Compare& __comp,
139 const _Allocator& __a = _Allocator())
140 : _Base(__comp, __a) { }
142 template<
typename _InputIterator>
143 multimap(_InputIterator __first, _InputIterator __last,
144 const _Compare& __comp = _Compare(),
145 const _Allocator& __a = _Allocator())
147 __glibcxx_check_valid_constructor_range(__first, __last)),
151 multimap(_Base_ref __x)
152 : _Base(__x._M_ref) { }
154#if __cplusplus < 201103L
156 operator=(
const multimap& __x)
158 this->_M_safe() = __x;
164 operator=(
const multimap&) =
default;
167 operator=(multimap&&) =
default;
173 this->_M_invalidate_all();
178 using _Base::get_allocator;
182 begin() _GLIBCXX_NOEXCEPT
183 {
return iterator(_Base::begin(),
this); }
186 begin()
const _GLIBCXX_NOEXCEPT
187 {
return const_iterator(_Base::begin(),
this); }
190 end() _GLIBCXX_NOEXCEPT
191 {
return iterator(_Base::end(),
this); }
194 end()
const _GLIBCXX_NOEXCEPT
195 {
return const_iterator(_Base::end(),
this); }
198 rbegin() _GLIBCXX_NOEXCEPT
199 {
return reverse_iterator(end()); }
201 const_reverse_iterator
202 rbegin()
const _GLIBCXX_NOEXCEPT
203 {
return const_reverse_iterator(end()); }
206 rend() _GLIBCXX_NOEXCEPT
207 {
return reverse_iterator(begin()); }
209 const_reverse_iterator
210 rend()
const _GLIBCXX_NOEXCEPT
211 {
return const_reverse_iterator(begin()); }
213#if __cplusplus >= 201103L
215 cbegin()
const noexcept
216 {
return const_iterator(_Base::begin(),
this); }
219 cend()
const noexcept
220 {
return const_iterator(_Base::end(),
this); }
222 const_reverse_iterator
223 crbegin()
const noexcept
224 {
return const_reverse_iterator(end()); }
226 const_reverse_iterator
227 crend()
const noexcept
228 {
return const_reverse_iterator(begin()); }
234 using _Base::max_size;
237#if __cplusplus >= 201103L
238 template<
typename... _Args>
240 emplace(_Args&&... __args)
243 template<
typename... _Args>
245 emplace_hint(const_iterator __pos, _Args&&... __args)
257 insert(
const value_type& __x)
258 {
return iterator(_Base::insert(__x),
this); }
260#if __cplusplus >= 201103L
264 insert(value_type&& __x)
265 {
return { _Base::insert(
std::move(__x)),
this }; }
267 template<
typename _Pair,
typename =
typename
275#if __cplusplus >= 201103L
278 { _Base::insert(__list); }
282#if __cplusplus >= 201103L
283 insert(const_iterator __position,
const value_type& __x)
285 insert(iterator __position,
const value_type& __x)
289 return iterator(_Base::insert(__position.
base(), __x),
this);
292#if __cplusplus >= 201103L
296 insert(const_iterator __position, value_type&& __x)
299 return { _Base::insert(__position.
base(),
std::move(__x)),
this };
302 template<
typename _Pair,
typename =
typename
306 insert(const_iterator __position, _Pair&& __x)
317 template<
typename _InputIterator>
319 insert(_InputIterator __first, _InputIterator __last)
321 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
322 __glibcxx_check_valid_range2(__first, __last, __dist);
324 if (__dist.second >= __gnu_debug::__dp_sign)
325 _Base::insert(__gnu_debug::__unsafe(__first),
326 __gnu_debug::__unsafe(__last));
328 _Base::insert(__first, __last);
331#if __cplusplus > 201402L
332 using node_type =
typename _Base::node_type;
335 extract(const_iterator __position)
338 this->_M_invalidate_if(_Equal(__position.
base()));
339 return _Base::extract(__position.
base());
343 extract(
const key_type& __key)
345 const auto __position = find(__key);
346 if (__position != end())
347 return extract(__position);
352 insert(node_type&& __nh)
353 {
return { _Base::insert(
std::move(__nh)),
this }; }
356 insert(const_iterator __hint, node_type&& __nh)
359 return { _Base::insert(__hint.
base(),
std::move(__nh)),
this };
365#if __cplusplus >= 201103L
367 erase(const_iterator __position)
370 this->_M_invalidate_if(_Equal(__position.
base()));
371 return { _Base::erase(__position.
base()),
this };
374 _GLIBCXX_ABI_TAG_CXX11
376 erase(iterator __position)
377 {
return erase(const_iterator(__position)); }
380 erase(iterator __position)
383 this->_M_invalidate_if(_Equal(__position.
base()));
384 _Base::erase(__position.
base());
389 erase(
const key_type& __x)
392 _Base::equal_range(__x);
393 size_type __count = 0;
394 _Base_iterator __victim = __victims.
first;
395 while (__victim != __victims.
second)
397 this->_M_invalidate_if(_Equal(__victim));
398 _Base::erase(__victim++);
404#if __cplusplus >= 201103L
406 erase(const_iterator __first, const_iterator __last)
411 for (_Base_const_iterator __victim = __first.base();
412 __victim != __last.
base(); ++__victim)
414 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
415 _M_message(__gnu_debug::__msg_valid_range)
416 ._M_iterator(__first,
"first")
417 ._M_iterator(__last,
"last"));
418 this->_M_invalidate_if(_Equal(__victim));
421 return { _Base::erase(__first.base(), __last.
base()),
this };
425 erase(iterator __first, iterator __last)
430 for (_Base_iterator __victim = __first.base();
431 __victim != __last.
base(); ++__victim)
433 _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
434 _M_message(__gnu_debug::__msg_valid_range)
435 ._M_iterator(__first,
"first")
436 ._M_iterator(__last,
"last"));
437 this->_M_invalidate_if(_Equal(__victim));
439 _Base::erase(__first.base(), __last.
base());
452 clear() _GLIBCXX_NOEXCEPT
454 this->_M_invalidate_all();
459 using _Base::key_comp;
460 using _Base::value_comp;
464 find(
const key_type& __x)
465 {
return iterator(_Base::find(__x),
this); }
467#if __cplusplus > 201103L
468 template<
typename _Kt,
470 typename __has_is_transparent<_Compare, _Kt>::type>
473 {
return { _Base::find(__x),
this }; }
477 find(
const key_type& __x)
const
478 {
return const_iterator(_Base::find(__x),
this); }
480#if __cplusplus > 201103L
481 template<
typename _Kt,
483 typename __has_is_transparent<_Compare, _Kt>::type>
485 find(
const _Kt& __x)
const
486 {
return { _Base::find(__x),
this }; }
492 lower_bound(
const key_type& __x)
493 {
return iterator(_Base::lower_bound(__x),
this); }
495#if __cplusplus > 201103L
496 template<
typename _Kt,
498 typename __has_is_transparent<_Compare, _Kt>::type>
500 lower_bound(
const _Kt& __x)
501 {
return { _Base::lower_bound(__x),
this }; }
505 lower_bound(
const key_type& __x)
const
506 {
return const_iterator(_Base::lower_bound(__x),
this); }
508#if __cplusplus > 201103L
509 template<
typename _Kt,
511 typename __has_is_transparent<_Compare, _Kt>::type>
513 lower_bound(
const _Kt& __x)
const
514 {
return { _Base::lower_bound(__x),
this }; }
518 upper_bound(
const key_type& __x)
519 {
return iterator(_Base::upper_bound(__x),
this); }
521#if __cplusplus > 201103L
522 template<
typename _Kt,
524 typename __has_is_transparent<_Compare, _Kt>::type>
526 upper_bound(
const _Kt& __x)
527 {
return { _Base::upper_bound(__x),
this }; }
531 upper_bound(
const key_type& __x)
const
532 {
return const_iterator(_Base::upper_bound(__x),
this); }
534#if __cplusplus > 201103L
535 template<
typename _Kt,
537 typename __has_is_transparent<_Compare, _Kt>::type>
539 upper_bound(
const _Kt& __x)
const
540 {
return { _Base::upper_bound(__x),
this }; }
544 equal_range(
const key_type& __x)
547 _Base::equal_range(__x);
549 iterator(__res.
second,
this));
552#if __cplusplus > 201103L
553 template<
typename _Kt,
555 typename __has_is_transparent<_Compare, _Kt>::type>
557 equal_range(
const _Kt& __x)
559 auto __res = _Base::equal_range(__x);
560 return { { __res.first,
this }, { __res.second,
this } };
565 equal_range(
const key_type& __x)
const
568 _Base::equal_range(__x);
570 const_iterator(__res.
second,
this));
573#if __cplusplus > 201103L
574 template<
typename _Kt,
576 typename __has_is_transparent<_Compare, _Kt>::type>
578 equal_range(
const _Kt& __x)
const
580 auto __res = _Base::equal_range(__x);
581 return { { __res.first,
this }, { __res.second,
this } };
586 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
589 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }