29 #ifndef _GLIBCXX_DEBUG_UNORDERED_MAP
30 #define _GLIBCXX_DEBUG_UNORDERED_MAP 1
32 #pragma GCC system_header
34 #if __cplusplus < 201103L
38 namespace std _GLIBCXX_VISIBILITY(default) {
namespace __debug {
39 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Pred,
42 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Pred,
44 class unordered_multimap;
54 namespace std _GLIBCXX_VISIBILITY(default)
59 template<
typename _Key,
typename _Tp,
65 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc,
66 __gnu_debug::_Safe_unordered_container>,
67 public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
69 typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash,
73 typedef typename _Base::const_iterator _Base_const_iterator;
74 typedef typename _Base::iterator _Base_iterator;
75 typedef typename _Base::const_local_iterator
76 _Base_const_local_iterator;
77 typedef typename _Base::local_iterator _Base_local_iterator;
79 template<
typename _ItT,
typename _SeqT,
typename _CatT>
80 friend class ::__gnu_debug::_Safe_iterator;
81 template<
typename _ItT,
typename _SeqT>
82 friend class ::__gnu_debug::_Safe_local_iterator;
85 typedef typename _Base::size_type size_type;
86 typedef typename _Base::hasher hasher;
87 typedef typename _Base::key_equal key_equal;
88 typedef typename _Base::allocator_type allocator_type;
90 typedef typename _Base::key_type key_type;
91 typedef typename _Base::value_type value_type;
106 const hasher& __hf = hasher(),
107 const key_equal& __eql = key_equal(),
108 const allocator_type& __a = allocator_type())
109 :
_Base(__n, __hf, __eql, __a) { }
111 template<
typename _InputIterator>
114 const hasher& __hf = hasher(),
115 const key_equal& __eql = key_equal(),
116 const allocator_type& __a = allocator_type())
118 __glibcxx_check_valid_constructor_range(__first, __last)),
120 __hf, __eql, __a) { }
134 const allocator_type& __a)
135 :
_Base(__umap, __a) { }
138 const allocator_type& __a)
145 const hasher& __hf = hasher(),
146 const key_equal& __eql = key_equal(),
147 const allocator_type& __a = allocator_type())
148 :
_Base(__l, __n, __hf, __eql, __a) { }
156 const allocator_type& __a)
160 template<
typename _InputIterator>
163 const allocator_type& __a)
164 :
unordered_map(__first, __last, __n, hasher(), key_equal(), __a)
167 template<
typename _InputIterator>
171 const allocator_type& __a)
172 :
unordered_map(__first, __last, __n, __hf, key_equal(), __a)
177 const allocator_type& __a)
184 const allocator_type& __a)
200 this->_M_invalidate_all();
206 noexcept( noexcept(declval<_Base&>().swap(__x)) )
216 this->_M_invalidate_all();
221 {
return { _Base::begin(),
this }; }
224 begin()
const noexcept
225 {
return { _Base::begin(),
this }; }
229 {
return { _Base::end(),
this }; }
233 {
return { _Base::end(),
this }; }
236 cbegin()
const noexcept
237 {
return { _Base::cbegin(),
this }; }
240 cend()
const noexcept
241 {
return { _Base::cend(),
this }; }
247 __glibcxx_check_bucket_index(__b);
248 return { _Base::begin(__b),
this };
254 __glibcxx_check_bucket_index(__b);
255 return { _Base::end(__b),
this };
259 begin(size_type __b)
const
261 __glibcxx_check_bucket_index(__b);
262 return { _Base::begin(__b),
this };
266 end(size_type __b)
const
268 __glibcxx_check_bucket_index(__b);
269 return { _Base::end(__b),
this };
273 cbegin(size_type __b)
const
275 __glibcxx_check_bucket_index(__b);
276 return { _Base::cbegin(__b),
this };
280 cend(size_type __b)
const
282 __glibcxx_check_bucket_index(__b);
283 return { _Base::cend(__b),
this };
287 bucket_size(size_type __b)
const
289 __glibcxx_check_bucket_index(__b);
290 return _Base::bucket_size(__b);
294 max_load_factor()
const noexcept
295 {
return _Base::max_load_factor(); }
298 max_load_factor(
float __f)
300 __glibcxx_check_max_load_factor(__f);
301 _Base::max_load_factor(__f);
304 template<
typename... _Args>
306 emplace(_Args&&... __args)
308 size_type __bucket_count = this->bucket_count();
309 auto __res = _Base::emplace(std::forward<_Args>(__args)...);
310 _M_check_rehashed(__bucket_count);
311 return { { __res.first,
this }, __res.second };
314 template<
typename... _Args>
319 size_type __bucket_count = this->bucket_count();
320 auto __it = _Base::emplace_hint(__hint.
base(),
321 std::forward<_Args>(__args)...);
322 _M_check_rehashed(__bucket_count);
323 return { __it,
this };
327 insert(
const value_type& __obj)
329 size_type __bucket_count = this->bucket_count();
330 auto __res = _Base::insert(__obj);
331 _M_check_rehashed(__bucket_count);
332 return { { __res.first,
this }, __res.second };
338 insert(value_type&& __x)
340 size_type __bucket_count = this->bucket_count();
341 auto __res = _Base::insert(
std::move(__x));
342 _M_check_rehashed(__bucket_count);
343 return { { __res.first,
this }, __res.second };
346 template<
typename _Pair,
typename =
typename
348 _Pair&&>::value>::type>
350 insert(_Pair&& __obj)
352 size_type __bucket_count = this->bucket_count();
353 auto __res = _Base::insert(std::forward<_Pair>(__obj));
354 _M_check_rehashed(__bucket_count);
355 return { { __res.first,
this }, __res.second };
362 size_type __bucket_count = this->bucket_count();
363 auto __it = _Base::insert(__hint.
base(), __obj);
364 _M_check_rehashed(__bucket_count);
365 return { __it,
this };
374 size_type __bucket_count = this->bucket_count();
376 _M_check_rehashed(__bucket_count);
377 return { __it,
this };
380 template<
typename _Pair,
typename =
typename
382 _Pair&&>::value>::type>
387 size_type __bucket_count = this->bucket_count();
388 auto __it = _Base::insert(__hint.
base(), std::forward<_Pair>(__obj));
389 _M_check_rehashed(__bucket_count);
390 return { __it,
this };
396 size_type __bucket_count = this->bucket_count();
398 _M_check_rehashed(__bucket_count);
401 template<
typename _InputIterator>
403 insert(_InputIterator __first, _InputIterator __last)
406 __glibcxx_check_valid_range2(__first, __last, __dist);
407 size_type __bucket_count = this->bucket_count();
409 if (__dist.
second >= __gnu_debug::__dp_sign)
410 _Base::insert(__gnu_debug::__unsafe(__first),
411 __gnu_debug::__unsafe(__last));
413 _Base::insert(__first, __last);
415 _M_check_rehashed(__bucket_count);
418 #if __cplusplus > 201402L
419 template <
typename... _Args>
421 try_emplace(
const key_type& __k, _Args&&... __args)
423 auto __res = _Base::try_emplace(__k,
424 std::forward<_Args>(__args)...);
425 return { { __res.first,
this }, __res.second };
428 template <
typename... _Args>
430 try_emplace(key_type&& __k, _Args&&... __args)
432 auto __res = _Base::try_emplace(
std::move(__k),
433 std::forward<_Args>(__args)...);
434 return { { __res.first,
this }, __res.second };
437 template <
typename... _Args>
443 return { _Base::try_emplace(__hint.
base(), __k,
444 std::forward<_Args>(__args)...),
448 template <
typename... _Args>
450 try_emplace(
const_iterator __hint, key_type&& __k, _Args&&... __args)
454 std::forward<_Args>(__args)...),
458 template <
typename _Obj>
460 insert_or_assign(
const key_type& __k, _Obj&& __obj)
462 auto __res = _Base::insert_or_assign(__k,
463 std::forward<_Obj>(__obj));
464 return { { __res.first,
this }, __res.second };
467 template <
typename _Obj>
469 insert_or_assign(key_type&& __k, _Obj&& __obj)
471 auto __res = _Base::insert_or_assign(
std::move(__k),
472 std::forward<_Obj>(__obj));
473 return { { __res.first,
this }, __res.second };
476 template <
typename _Obj>
482 return { _Base::insert_or_assign(__hint.
base(), __k,
483 std::forward<_Obj>(__obj)),
487 template <
typename _Obj>
489 insert_or_assign(
const_iterator __hint, key_type&& __k, _Obj&& __obj)
492 return { _Base::insert_or_assign(__hint.
base(),
std::move(__k),
493 std::forward<_Obj>(__obj)),
498 #if __cplusplus > 201402L
499 using node_type =
typename _Base::node_type;
500 using insert_return_type = _Node_insert_return<iterator, node_type>;
506 return _M_extract(__position.
base());
510 extract(
const key_type& __key)
512 const auto __position = _Base::find(__key);
513 if (__position != _Base::end())
514 return _M_extract(__position);
519 insert(node_type&& __nh)
521 auto __ret = _Base::insert(
std::move(__nh));
523 { { __ret.position,
this }, __ret.inserted,
std::move(__ret.node) };
530 return { _Base::insert(__hint.
base(),
std::move(__nh)),
this };
537 find(
const key_type& __key)
538 {
return { _Base::find(__key),
this }; }
541 find(
const key_type& __key)
const
542 {
return { _Base::find(__key),
this }; }
545 equal_range(
const key_type& __key)
547 auto __res = _Base::equal_range(__key);
548 return { { __res.first,
this }, { __res.second,
this } };
552 equal_range(
const key_type& __key)
const
554 auto __res = _Base::equal_range(__key);
555 return { { __res.first,
this }, { __res.second,
this } };
559 erase(
const key_type& __key)
562 auto __victim = _Base::find(__key);
563 if (__victim != _Base::end())
575 return { _M_erase(__it.
base()),
this };
582 return { _M_erase(__it.
base()),
this };
589 for (
auto __tmp = __first.base(); __tmp != __last.
base(); ++__tmp)
591 _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(),
592 _M_message(__gnu_debug::__msg_valid_range)
593 ._M_iterator(__first,
"first")
594 ._M_iterator(__last,
"last"));
595 _M_invalidate(__tmp);
598 size_type __bucket_count = this->bucket_count();
599 auto __next = _Base::erase(__first.base(), __last.
base());
600 _M_check_rehashed(__bucket_count);
601 return { __next,
this };
605 _M_base() noexcept {
return *
this; }
608 _M_base()
const noexcept {
return *
this; }
612 _M_check_rehashed(size_type __prev_count)
614 if (__prev_count != this->bucket_count())
615 this->_M_invalidate_all();
619 _M_invalidate(_Base_const_iterator __victim)
622 [__victim](_Base_const_iterator __it) {
return __it == __victim; });
624 [__victim](_Base_const_local_iterator __it)
625 {
return __it._M_curr() == __victim._M_cur; });
629 _M_erase(_Base_const_iterator __victim)
631 _M_invalidate(__victim);
632 size_type __bucket_count = this->bucket_count();
633 _Base_iterator __next = _Base::erase(__victim);
634 _M_check_rehashed(__bucket_count);
638 #if __cplusplus > 201402L
640 _M_extract(_Base_const_iterator __victim)
642 _M_invalidate(__victim);
643 return _Base::extract(__victim);
648 #if __cpp_deduction_guides >= 201606
650 template<
typename _InputIterator,
654 typename = _RequireInputIter<_InputIterator>,
655 typename = _RequireNotAllocatorOrIntegral<_Hash>,
656 typename = _RequireNotAllocator<_Pred>,
657 typename = _RequireAllocator<_Allocator>>
659 typename unordered_map<int, int>::size_type = {},
660 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
662 __iter_val_t<_InputIterator>,
663 _Hash, _Pred, _Allocator>;
665 template<
typename _Key,
typename _Tp,
typename _Hash = hash<_Key>,
666 typename _Pred = equal_to<_Key>,
667 typename _Allocator = allocator<pair<const _Key, _Tp>>,
668 typename = _RequireNotAllocatorOrIntegral<_Hash>,
669 typename = _RequireNotAllocator<_Pred>,
670 typename = _RequireAllocator<_Allocator>>
673 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
674 -> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>;
676 template<
typename _InputIterator,
typename _Allocator,
677 typename = _RequireInputIter<_InputIterator>,
678 typename = _RequireAllocator<_Allocator>>
679 unordered_map(_InputIterator, _InputIterator,
680 typename unordered_map<int, int>::size_type, _Allocator)
681 -> unordered_map<__iter_key_t<_InputIterator>,
682 __iter_val_t<_InputIterator>,
683 hash<__iter_key_t<_InputIterator>>,
684 equal_to<__iter_key_t<_InputIterator>>,
687 template<
typename _InputIterator,
typename _Allocator,
688 typename = _RequireInputIter<_InputIterator>,
689 typename = _RequireAllocator<_Allocator>>
690 unordered_map(_InputIterator, _InputIterator, _Allocator)
691 -> unordered_map<__iter_key_t<_InputIterator>,
692 __iter_val_t<_InputIterator>,
693 hash<__iter_key_t<_InputIterator>>,
694 equal_to<__iter_key_t<_InputIterator>>,
697 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
698 typename = _RequireInputIter<_InputIterator>,
699 typename = _RequireNotAllocatorOrIntegral<_Hash>,
700 typename = _RequireAllocator<_Allocator>>
701 unordered_map(_InputIterator, _InputIterator,
702 typename unordered_map<int, int>::size_type,
704 -> unordered_map<__iter_key_t<_InputIterator>,
705 __iter_val_t<_InputIterator>, _Hash,
706 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
708 template<
typename _Key,
typename _Tp,
typename _Allocator,
709 typename = _RequireAllocator<_Allocator>>
710 unordered_map(initializer_list<pair<_Key, _Tp>>,
711 typename unordered_map<int, int>::size_type,
713 -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
715 template<
typename _Key,
typename _Tp,
typename _Allocator,
716 typename = _RequireAllocator<_Allocator>>
717 unordered_map(initializer_list<pair<_Key, _Tp>>, _Allocator)
718 -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
720 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Allocator,
721 typename = _RequireNotAllocatorOrIntegral<_Hash>,
722 typename = _RequireAllocator<_Allocator>>
723 unordered_map(initializer_list<pair<_Key, _Tp>>,
724 typename unordered_map<int, int>::size_type,
726 -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
730 template<
typename _Key,
typename _Tp,
typename _Hash,
731 typename _Pred,
typename _Alloc>
733 swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
734 unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
735 noexcept(noexcept(__x.swap(__y)))
738 template<
typename _Key,
typename _Tp,
typename _Hash,
739 typename _Pred,
typename _Alloc>
741 operator==(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
742 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
743 {
return __x._M_base() == __y._M_base(); }
745 #if __cpp_impl_three_way_comparison < 201907L
746 template<
typename _Key,
typename _Tp,
typename _Hash,
747 typename _Pred,
typename _Alloc>
749 operator!=(
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
750 const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
751 {
return !(__x == __y); }
755 template<
typename _Key,
typename _Tp,
761 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc,
762 __gnu_debug::_Safe_unordered_container>,
763 public _GLIBCXX_STD_C::unordered_multimap<
764 _Key, _Tp, _Hash, _Pred, _Alloc>
766 typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
767 _Pred, _Alloc>
_Base;
770 typedef typename _Base::const_iterator _Base_const_iterator;
771 typedef typename _Base::iterator _Base_iterator;
772 typedef typename _Base::const_local_iterator _Base_const_local_iterator;
773 typedef typename _Base::local_iterator _Base_local_iterator;
775 template<
typename _ItT,
typename _SeqT,
typename _CatT>
776 friend class ::__gnu_debug::_Safe_iterator;
777 template<
typename _ItT,
typename _SeqT>
778 friend class ::__gnu_debug::_Safe_local_iterator;
781 typedef typename _Base::size_type size_type;
782 typedef typename _Base::hasher hasher;
783 typedef typename _Base::key_equal key_equal;
784 typedef typename _Base::allocator_type allocator_type;
786 typedef typename _Base::key_type key_type;
787 typedef typename _Base::value_type value_type;
802 const hasher& __hf = hasher(),
803 const key_equal& __eql = key_equal(),
804 const allocator_type& __a = allocator_type())
805 :
_Base(__n, __hf, __eql, __a) { }
807 template<
typename _InputIterator>
810 const hasher& __hf = hasher(),
811 const key_equal& __eql = key_equal(),
812 const allocator_type& __a = allocator_type())
814 __glibcxx_check_valid_constructor_range(__first, __last)),
816 __hf, __eql, __a) { }
830 const allocator_type& __a)
831 :
_Base(__umap, __a) { }
834 const allocator_type& __a)
841 const hasher& __hf = hasher(),
842 const key_equal& __eql = key_equal(),
843 const allocator_type& __a = allocator_type())
844 :
_Base(__l, __n, __hf, __eql, __a) { }
851 const allocator_type& __a)
855 template<
typename _InputIterator>
858 const allocator_type& __a)
862 template<
typename _InputIterator>
864 size_type __n,
const hasher& __hf,
865 const allocator_type& __a)
871 const allocator_type& __a)
876 size_type __n,
const hasher& __hf,
877 const allocator_type& __a)
892 this->_M_base() = __l;
893 this->_M_invalidate_all();
899 noexcept( noexcept(declval<_Base&>().swap(__x)) )
909 this->_M_invalidate_all();
914 {
return { _Base::begin(),
this }; }
917 begin()
const noexcept
918 {
return { _Base::begin(),
this }; }
922 {
return { _Base::end(),
this }; }
926 {
return { _Base::end(),
this }; }
929 cbegin()
const noexcept
930 {
return { _Base::cbegin(),
this }; }
933 cend()
const noexcept
934 {
return { _Base::cend(),
this }; }
940 __glibcxx_check_bucket_index(__b);
941 return { _Base::begin(__b),
this };
947 __glibcxx_check_bucket_index(__b);
948 return { _Base::end(__b),
this };
952 begin(size_type __b)
const
954 __glibcxx_check_bucket_index(__b);
955 return { _Base::begin(__b),
this };
959 end(size_type __b)
const
961 __glibcxx_check_bucket_index(__b);
962 return { _Base::end(__b),
this };
966 cbegin(size_type __b)
const
968 __glibcxx_check_bucket_index(__b);
969 return { _Base::cbegin(__b),
this };
973 cend(size_type __b)
const
975 __glibcxx_check_bucket_index(__b);
976 return { _Base::cend(__b),
this };
980 bucket_size(size_type __b)
const
982 __glibcxx_check_bucket_index(__b);
983 return _Base::bucket_size(__b);
987 max_load_factor()
const noexcept
988 {
return _Base::max_load_factor(); }
991 max_load_factor(
float __f)
993 __glibcxx_check_max_load_factor(__f);
994 _Base::max_load_factor(__f);
997 template<
typename... _Args>
999 emplace(_Args&&... __args)
1001 size_type __bucket_count = this->bucket_count();
1002 auto __it = _Base::emplace(std::forward<_Args>(__args)...);
1003 _M_check_rehashed(__bucket_count);
1004 return { __it,
this };
1007 template<
typename... _Args>
1012 size_type __bucket_count = this->bucket_count();
1013 auto __it = _Base::emplace_hint(__hint.
base(),
1014 std::forward<_Args>(__args)...);
1015 _M_check_rehashed(__bucket_count);
1016 return { __it,
this };
1020 insert(
const value_type& __obj)
1022 size_type __bucket_count = this->bucket_count();
1023 auto __it = _Base::insert(__obj);
1024 _M_check_rehashed(__bucket_count);
1025 return { __it,
this };
1031 insert(value_type&& __x)
1033 size_type __bucket_count = this->bucket_count();
1034 auto __it = _Base::insert(
std::move(__x));
1035 _M_check_rehashed(__bucket_count);
1036 return { __it,
this };
1043 size_type __bucket_count = this->bucket_count();
1044 auto __it = _Base::insert(__hint.
base(), __obj);
1045 _M_check_rehashed(__bucket_count);
1046 return { __it,
this };
1055 size_type __bucket_count = this->bucket_count();
1057 _M_check_rehashed(__bucket_count);
1058 return { __it,
this };
1061 template<
typename _Pair,
typename =
typename
1063 _Pair&&>::value>::type>
1065 insert(_Pair&& __obj)
1067 size_type __bucket_count = this->bucket_count();
1068 auto __it = _Base::insert(std::forward<_Pair>(__obj));
1069 _M_check_rehashed(__bucket_count);
1070 return { __it,
this };
1073 template<
typename _Pair,
typename =
typename
1075 _Pair&&>::value>::type>
1080 size_type __bucket_count = this->bucket_count();
1081 auto __it = _Base::insert(__hint.
base(), std::forward<_Pair>(__obj));
1082 _M_check_rehashed(__bucket_count);
1083 return { __it,
this };
1088 { _Base::insert(__l); }
1090 template<
typename _InputIterator>
1092 insert(_InputIterator __first, _InputIterator __last)
1095 __glibcxx_check_valid_range2(__first, __last, __dist);
1096 size_type __bucket_count = this->bucket_count();
1098 if (__dist.
second >= __gnu_debug::__dp_sign)
1099 _Base::insert(__gnu_debug::__unsafe(__first),
1100 __gnu_debug::__unsafe(__last));
1102 _Base::insert(__first, __last);
1104 _M_check_rehashed(__bucket_count);
1107 #if __cplusplus > 201402L
1108 using node_type =
typename _Base::node_type;
1114 return _M_extract(__position.
base());
1118 extract(
const key_type& __key)
1120 const auto __position = _Base::find(__key);
1121 if (__position != _Base::end())
1122 return _M_extract(__position);
1127 insert(node_type&& __nh)
1128 {
return { _Base::insert(
std::move(__nh)),
this }; }
1134 return { _Base::insert(__hint.
base(),
std::move(__nh)),
this };
1141 find(
const key_type& __key)
1142 {
return { _Base::find(__key),
this }; }
1145 find(
const key_type& __key)
const
1146 {
return { _Base::find(__key),
this }; }
1149 equal_range(
const key_type& __key)
1151 auto __res = _Base::equal_range(__key);
1152 return { { __res.first,
this }, { __res.second,
this } };
1156 equal_range(
const key_type& __key)
const
1158 auto __res = _Base::equal_range(__key);
1159 return { { __res.first,
this }, { __res.second,
this } };
1163 erase(
const key_type& __key)
1166 size_type __bucket_count = this->bucket_count();
1167 auto __pair = _Base::equal_range(__key);
1168 for (
auto __victim = __pair.first; __victim != __pair.second;)
1170 _M_invalidate(__victim);
1171 __victim = _Base::erase(__victim);
1175 _M_check_rehashed(__bucket_count);
1183 return { _M_erase(__it.
base()),
this };
1190 return { _M_erase(__it.
base()),
this };
1197 for (
auto __tmp = __first.base(); __tmp != __last.
base(); ++__tmp)
1199 _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(),
1200 _M_message(__gnu_debug::__msg_valid_range)
1201 ._M_iterator(__first,
"first")
1202 ._M_iterator(__last,
"last"));
1203 _M_invalidate(__tmp);
1206 size_type __bucket_count = this->bucket_count();
1207 auto __next = _Base::erase(__first.base(), __last.
base());
1208 _M_check_rehashed(__bucket_count);
1209 return { __next,
this };
1213 _M_base() noexcept {
return *
this; }
1216 _M_base()
const noexcept {
return *
this; }
1220 _M_check_rehashed(size_type __prev_count)
1222 if (__prev_count != this->bucket_count())
1223 this->_M_invalidate_all();
1227 _M_invalidate(_Base_const_iterator __victim)
1230 [__victim](_Base_const_iterator __it) {
return __it == __victim; });
1232 [__victim](_Base_const_local_iterator __it)
1233 {
return __it._M_curr() == __victim._M_cur; });
1237 _M_erase(_Base_const_iterator __victim)
1239 _M_invalidate(__victim);
1240 size_type __bucket_count = this->bucket_count();
1241 _Base_iterator __next = _Base::erase(__victim);
1242 _M_check_rehashed(__bucket_count);
1246 #if __cplusplus > 201402L
1248 _M_extract(_Base_const_iterator __victim)
1250 _M_invalidate(__victim);
1251 return _Base::extract(__victim);
1256 #if __cpp_deduction_guides >= 201606
1258 template<
typename _InputIterator,
1262 typename = _RequireInputIter<_InputIterator>,
1263 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1264 typename = _RequireNotAllocator<_Pred>,
1265 typename = _RequireAllocator<_Allocator>>
1267 unordered_multimap<int, int>::size_type = {},
1268 _Hash = _Hash(), _Pred = _Pred(),
1269 _Allocator = _Allocator())
1271 __iter_val_t<_InputIterator>, _Hash, _Pred,
1274 template<
typename _Key,
typename _Tp,
typename _Hash = hash<_Key>,
1275 typename _Pred = equal_to<_Key>,
1276 typename _Allocator = allocator<pair<const _Key, _Tp>>,
1277 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1278 typename = _RequireNotAllocator<_Pred>,
1279 typename = _RequireAllocator<_Allocator>>
1282 _Hash = _Hash(), _Pred = _Pred(),
1283 _Allocator = _Allocator())
1284 -> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>;
1286 template<
typename _InputIterator,
typename _Allocator,
1287 typename = _RequireInputIter<_InputIterator>,
1288 typename = _RequireAllocator<_Allocator>>
1289 unordered_multimap(_InputIterator, _InputIterator,
1290 unordered_multimap<int, int>::size_type, _Allocator)
1291 -> unordered_multimap<__iter_key_t<_InputIterator>,
1292 __iter_val_t<_InputIterator>,
1293 hash<__iter_key_t<_InputIterator>>,
1294 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
1296 template<
typename _InputIterator,
typename _Allocator,
1297 typename = _RequireInputIter<_InputIterator>,
1298 typename = _RequireAllocator<_Allocator>>
1299 unordered_multimap(_InputIterator, _InputIterator, _Allocator)
1300 -> unordered_multimap<__iter_key_t<_InputIterator>,
1301 __iter_val_t<_InputIterator>,
1302 hash<__iter_key_t<_InputIterator>>,
1303 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
1305 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1306 typename = _RequireInputIter<_InputIterator>,
1307 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1308 typename = _RequireAllocator<_Allocator>>
1309 unordered_multimap(_InputIterator, _InputIterator,
1310 unordered_multimap<int, int>::size_type, _Hash,
1312 -> unordered_multimap<__iter_key_t<_InputIterator>,
1313 __iter_val_t<_InputIterator>, _Hash,
1314 equal_to<__iter_key_t<_InputIterator>>, _Allocator>;
1316 template<
typename _Key,
typename _Tp,
typename _Allocator,
1317 typename = _RequireAllocator<_Allocator>>
1318 unordered_multimap(initializer_list<pair<_Key, _Tp>>,
1319 unordered_multimap<int, int>::size_type,
1321 -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
1323 template<
typename _Key,
typename _Tp,
typename _Allocator,
1324 typename = _RequireAllocator<_Allocator>>
1325 unordered_multimap(initializer_list<pair<_Key, _Tp>>, _Allocator)
1326 -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>;
1328 template<
typename _Key,
typename _Tp,
typename _Hash,
typename _Allocator,
1329 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1330 typename = _RequireAllocator<_Allocator>>
1331 unordered_multimap(initializer_list<pair<_Key, _Tp>>,
1332 unordered_multimap<int, int>::size_type,
1334 -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>;
1338 template<
typename _Key,
typename _Tp,
typename _Hash,
1339 typename _Pred,
typename _Alloc>
1341 swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1342 unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1343 noexcept(noexcept(__x.swap(__y)))
1346 template<
typename _Key,
typename _Tp,
typename _Hash,
1347 typename _Pred,
typename _Alloc>
1349 operator==(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1350 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1351 {
return __x._M_base() == __y._M_base(); }
1353 #if __cpp_impl_three_way_comparison < 201907L
1354 template<
typename _Key,
typename _Tp,
typename _Hash,
1355 typename _Pred,
typename _Alloc>
1357 operator!=(
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
1358 const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
1359 {
return !(__x == __y); }
#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)
Primary class template hash.
Define a member typedef type only if a boolean constant is true.
The standard allocator, as per C++03 [20.4.1].
One of the comparison functors.
Struct holding two objects of arbitrary type.
_T2 second
The second member.
A standard container composed of equivalent keys (possibly containing multiple of each key value) tha...
_Hashtable::size_type size_type
Iterator-related typedefs.
A standard container composed of unique keys (containing at most one of each key value) that associat...
_Hashtable::size_type size_type
Iterator-related typedefs.
_Iterator & base() noexcept
Return the underlying iterator.
Base class that supports tracking of iterators that reference a sequence.
Safe class dealing with some allocator dependent operations.
Base class for constructing a safe unordered container type that tracks iterators that reference it.
void _M_invalidate_local_if(_Predicate __pred)
void _M_invalidate_if(_Predicate __pred)
Class std::unordered_map with safety/checking/debug instrumentation.
Class std::unordered_multimap with safety/checking/debug instrumentation.