29#ifndef _GLIBCXX_DEBUG_MULTIMAP_H
30#define _GLIBCXX_DEBUG_MULTIMAP_H 1
37namespace 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> > >
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<
59 template<
typename _ItT,
typename _SeqT,
typename _CatT>
60 friend class ::__gnu_debug::_Safe_iterator;
67 _Base_ref(
const _Base& __r) : _M_ref(__r) { }
75 typedef _Tp mapped_type;
77 typedef _Compare key_compare;
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
109 const _Compare& __c = _Compare(),
129 template<
typename _InputIterator>
133 __glibcxx_check_valid_constructor_range(__first, __last)),
139 explicit multimap(
const _Compare& __comp,
141 :
_Base(__comp, __a) { }
143 template<
typename _InputIterator>
145 const _Compare& __comp = _Compare(),
148 __glibcxx_check_valid_constructor_range(__first, __last)),
153 :
_Base(__x._M_ref) { }
155#if __cplusplus >= 201103L
157 operator=(
const multimap&) =
default;
165 _Base::operator=(
__l);
166 this->_M_invalidate_all();
171 using _Base::get_allocator;
176 {
return iterator(_Base::begin(),
this); }
184 {
return iterator(_Base::end(),
this); }
206#if __cplusplus >= 201103L
208 cbegin()
const noexcept
212 cend()
const noexcept
216 crbegin()
const noexcept
220 crend()
const noexcept
227 using _Base::max_size;
230#if __cplusplus >= 201103L
231 template<
typename...
_Args>
236 template<
typename...
_Args>
251 {
return iterator(_Base::insert(__x),
this); }
253#if __cplusplus >= 201103L
258 {
return { _Base::insert(
std::move(__x)),
this }; }
260 template<
typename _Pair,
typename =
typename
262 _Pair&&>::value>::type>
268#if __cplusplus >= 201103L
271 { _Base::insert(
__list); }
275#if __cplusplus >= 201103L
285#if __cplusplus >= 201103L
295 template<
typename _Pair,
typename =
typename
297 _Pair&&>::value>::type>
310 template<
typename _InputIterator>
315 __glibcxx_check_valid_range2(__first, __last,
__dist);
317 if (
__dist.second >= __gnu_debug::__dp_sign)
318 _Base::insert(__gnu_debug::__unsafe(__first),
319 __gnu_debug::__unsafe(__last));
321 _Base::insert(__first, __last);
324#if __cplusplus > 201402L
325 using node_type =
typename _Base::node_type;
345 insert(node_type&&
__nh)
358#if __cplusplus >= 201103L
374 _GLIBCXX_ABI_TAG_CXX11
392 _Base::equal_range(__x);
393 size_type __count = 0;
404#if __cplusplus >= 201103L
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"));
421 return { _Base::erase(__first.base(), __last.
base()),
this };
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"));
439 _Base::erase(__first.base(), __last.
base());
454 this->_M_invalidate_all();
459 using _Base::key_comp;
460 using _Base::value_comp;
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 }; }
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 }; }
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
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 }; }
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
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 }; }
547 _Base::equal_range(__x);
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);
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 } };
592#if __cpp_deduction_guides >= 201606
605 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
606 typename _Allocator = allocator<pair<const _Key, _Tp>>,
607 typename = _RequireNotAllocator<_Compare>,
608 typename = _RequireAllocator<_Allocator>>
627 template<
typename _Key,
typename _Tp,
632 {
return __lhs._M_base() ==
__rhs._M_base(); }
634#if __cpp_lib_three_way_comparison
635 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
636 inline __detail::__synth3way_t<pair<const _Key, _Tp>>
639 {
return __lhs._M_base() <=>
__rhs._M_base(); }
641 template<
typename _Key,
typename _Tp,
642 typename _Compare,
typename _Allocator>
644 operator!=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
645 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
646 {
return __lhs._M_base() != __rhs._M_base(); }
648 template<
typename _Key,
typename _Tp,
649 typename _Compare,
typename _Allocator>
651 operator<(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
652 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
653 {
return __lhs._M_base() < __rhs._M_base(); }
655 template<
typename _Key,
typename _Tp,
656 typename _Compare,
typename _Allocator>
658 operator<=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
659 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
660 {
return __lhs._M_base() <= __rhs._M_base(); }
662 template<
typename _Key,
typename _Tp,
663 typename _Compare,
typename _Allocator>
665 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
666 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
667 {
return __lhs._M_base() >= __rhs._M_base(); }
669 template<
typename _Key,
typename _Tp,
670 typename _Compare,
typename _Allocator>
672 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
673 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
674 {
return __lhs._M_base() > __rhs._M_base(); }
677 template<
typename _Key,
typename _Tp,
678 typename _Compare,
typename _Allocator>
680 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
681 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
682 _GLIBCXX_NOEXCEPT_IF(
noexcept(__lhs.swap(__rhs)))
683 { __lhs.swap(__rhs); }
#define __glibcxx_check_insert(_Position)
#define __glibcxx_check_erase_range(_First, _Last)
#define __glibcxx_check_erase(_Position)
constexpr bool operator<=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>=(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator<(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr bool operator>(const duration< _Rep1, _Period1 > &__lhs, const duration< _Rep2, _Period2 > &__rhs)
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
ISO C++ entities toplevel namespace is std.
constexpr _Iterator __base(_Iterator __it)
Define a member typedef type only if a boolean constant is true.
constexpr _Iterator & base() noexcept
Return the underlying iterator.
Struct holding two objects of arbitrary type.
Class std::multimap with safety/checking/debug instrumentation.
Safe class dealing with some allocator dependent operations.
Like _Safe_sequence but with a special _M_invalidate_all implementation not invalidating past-the-end...