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;
65 typedef _Tp mapped_type;
67 typedef _Compare key_compare;
69 typedef typename _Base::reference reference;
70 typedef typename _Base::const_reference const_reference;
77 typedef typename _Base::size_type size_type;
78 typedef typename _Base::difference_type difference_type;
79 typedef typename _Base::pointer pointer;
80 typedef typename _Base::const_pointer const_pointer;
86#if __cplusplus < 201103L
99 const _Compare& __c = _Compare(),
118 template<
typename _InputIterator>
122 __glibcxx_check_valid_constructor_range(__first, __last)),
128 explicit multimap(
const _Compare& __comp,
130 :
_Base(__comp, __a) { }
132 template<
typename _InputIterator>
134 const _Compare& __comp = _Compare(),
137 __glibcxx_check_valid_constructor_range(__first, __last)),
144#if __cplusplus < 201103L
148 this->_M_safe() = __x;
154 operator=(
const multimap&) =
default;
163 this->_M_invalidate_all();
168 using _Base::get_allocator;
173 {
return iterator(_Base::begin(),
this); }
181 {
return iterator(_Base::end(),
this); }
203#if __cplusplus >= 201103L
205 cbegin()
const noexcept
209 cend()
const noexcept
213 crbegin()
const noexcept
217 crend()
const noexcept
224 using _Base::max_size;
227#if __cplusplus >= 201103L
228 template<
typename...
_Args>
233 template<
typename...
_Args>
248 {
return iterator(_Base::insert(__x),
this); }
250#if __cplusplus >= 201103L
255 {
return { _Base::insert(
std::move(__x)),
this }; }
257 template<
typename _Pair,
typename =
typename
259 _Pair&&>::value>::type>
265#if __cplusplus >= 201103L
268 { _Base::insert(
__list); }
272#if __cplusplus >= 201103L
282#if __cplusplus >= 201103L
292 template<
typename _Pair,
typename =
typename
294 _Pair&&>::value>::type>
307 template<
typename _InputIterator>
312 __glibcxx_check_valid_range2(__first, __last,
__dist);
314 if (
__dist.second >= __gnu_debug::__dp_sign)
315 _Base::insert(__gnu_debug::__unsafe(__first),
316 __gnu_debug::__unsafe(__last));
318 _Base::insert(__first, __last);
321#if __cplusplus > 201402L
322 using node_type =
typename _Base::node_type;
342 insert(node_type&&
__nh)
355#if __cplusplus >= 201103L
361 return { _Base::erase(
__position.base()),
this };
364 _GLIBCXX_ABI_TAG_CXX11
382 _Base::equal_range(__x);
383 size_type __count = 0;
394#if __cplusplus >= 201103L
404 _GLIBCXX_DEBUG_VERIFY(
__victim != _Base::cend(),
405 _M_message(__gnu_debug::__msg_valid_range)
406 ._M_iterator(__first,
"first")
407 ._M_iterator(__last,
"last"));
411 return { _Base::erase(__first.base(), __last.
base()),
this };
423 _GLIBCXX_DEBUG_VERIFY(
__victim != _Base::end(),
424 _M_message(__gnu_debug::__msg_valid_range)
425 ._M_iterator(__first,
"first")
426 ._M_iterator(__last,
"last"));
429 _Base::erase(__first.base(), __last.
base());
444 this->_M_invalidate_all();
449 using _Base::key_comp;
450 using _Base::value_comp;
455 {
return iterator(_Base::find(__x),
this); }
457#if __cplusplus > 201103L
458 template<
typename _Kt,
460 typename __has_is_transparent<_Compare, _Kt>::type>
463 {
return { _Base::find(__x),
this }; }
470#if __cplusplus > 201103L
471 template<
typename _Kt,
473 typename __has_is_transparent<_Compare, _Kt>::type>
475 find(
const _Kt& __x)
const
476 {
return { _Base::find(__x),
this }; }
483 {
return iterator(_Base::lower_bound(__x),
this); }
485#if __cplusplus > 201103L
486 template<
typename _Kt,
488 typename __has_is_transparent<_Compare, _Kt>::type>
490 lower_bound(
const _Kt& __x)
491 {
return { _Base::lower_bound(__x),
this }; }
495 lower_bound(
const key_type& __x)
const
498#if __cplusplus > 201103L
499 template<
typename _Kt,
501 typename __has_is_transparent<_Compare, _Kt>::type>
503 lower_bound(
const _Kt& __x)
const
504 {
return { _Base::lower_bound(__x),
this }; }
509 {
return iterator(_Base::upper_bound(__x),
this); }
511#if __cplusplus > 201103L
512 template<
typename _Kt,
514 typename __has_is_transparent<_Compare, _Kt>::type>
516 upper_bound(
const _Kt& __x)
517 {
return { _Base::upper_bound(__x),
this }; }
521 upper_bound(
const key_type& __x)
const
524#if __cplusplus > 201103L
525 template<
typename _Kt,
527 typename __has_is_transparent<_Compare, _Kt>::type>
529 upper_bound(
const _Kt& __x)
const
530 {
return { _Base::upper_bound(__x),
this }; }
537 _Base::equal_range(__x);
542#if __cplusplus > 201103L
543 template<
typename _Kt,
545 typename __has_is_transparent<_Compare, _Kt>::type>
547 equal_range(
const _Kt& __x)
549 auto __res = _Base::equal_range(__x);
550 return { {
__res.first,
this }, {
__res.second,
this } };
555 equal_range(
const key_type& __x)
const
558 _Base::equal_range(__x);
563#if __cplusplus > 201103L
564 template<
typename _Kt,
566 typename __has_is_transparent<_Compare, _Kt>::type>
568 equal_range(
const _Kt& __x)
const
570 auto __res = _Base::equal_range(__x);
571 return { {
__res.first,
this }, {
__res.second,
this } };
582#if __cpp_deduction_guides >= 201606
595 template<
typename _Key,
typename _Tp,
typename _Compare = less<_Key>,
596 typename _Allocator = allocator<pair<const _Key, _Tp>>,
597 typename = _RequireNotAllocator<_Compare>,
598 typename = _RequireAllocator<_Allocator>>
617 template<
typename _Key,
typename _Tp,
622 {
return __lhs._M_base() ==
__rhs._M_base(); }
624#if __cpp_lib_three_way_comparison
625 template<
typename _Key,
typename _Tp,
typename _Compare,
typename _Alloc>
626 inline __detail::__synth3way_t<pair<const _Key, _Tp>>
629 {
return __lhs._M_base() <=>
__rhs._M_base(); }
631 template<
typename _Key,
typename _Tp,
632 typename _Compare,
typename _Allocator>
634 operator!=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
635 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
636 {
return __lhs._M_base() != __rhs._M_base(); }
638 template<
typename _Key,
typename _Tp,
639 typename _Compare,
typename _Allocator>
641 operator<(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
642 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
643 {
return __lhs._M_base() < __rhs._M_base(); }
645 template<
typename _Key,
typename _Tp,
646 typename _Compare,
typename _Allocator>
648 operator<=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
649 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
650 {
return __lhs._M_base() <= __rhs._M_base(); }
652 template<
typename _Key,
typename _Tp,
653 typename _Compare,
typename _Allocator>
655 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
656 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
657 {
return __lhs._M_base() >= __rhs._M_base(); }
659 template<
typename _Key,
typename _Tp,
660 typename _Compare,
typename _Allocator>
662 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
663 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
664 {
return __lhs._M_base() > __rhs._M_base(); }
667 template<
typename _Key,
typename _Tp,
668 typename _Compare,
typename _Allocator>
670 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
671 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
672 _GLIBCXX_NOEXCEPT_IF(
noexcept(__lhs.swap(__rhs)))
673 { __lhs.swap(__rhs); }
#define __glibcxx_check_insert(_Position)
#define __glibcxx_check_erase_range(_First, _Last)
#define __glibcxx_check_erase(_Position)
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.
Struct holding two objects of arbitrary type.
_Iterator & base() noexcept
Return the underlying iterator.
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...