30 #ifndef _UNORDERED_SET_H
31 #define _UNORDERED_SET_H
37 #if __glibcxx_containers_ranges // C++ >= 23
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
44 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
50 template<
typename _Value,
55 using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc,
56 __detail::_Identity, _Pred, _Hash,
57 __detail::_Mod_range_hashing,
58 __detail::_Default_ranged_hash,
59 __detail::_Prime_rehash_policy, _Tr>;
65 template<
typename _Value,
70 using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc,
73 __detail::_Mod_range_hashing,
74 __detail::_Default_ranged_hash,
75 __detail::_Prime_rehash_policy, _Tr>;
77 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
103 template<
typename _Value,
109 typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
118 typedef typename _Hashtable::hasher
hasher;
137 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
138 using node_type =
typename _Hashtable::node_type;
139 using insert_return_type =
typename _Hashtable::insert_return_type;
159 : _M_h(__n, __hf, __eql, __a)
175 template<
typename _InputIterator>
181 : _M_h(__first, __last, __n, __hf, __eql, __a)
206 : _M_h(__uset._M_h, __a)
216 noexcept( noexcept(_Hashtable(
std::move(__uset._M_h), __a)) )
217 : _M_h(
std::
move(__uset._M_h), __a)
236 : _M_h(__l, __n, __hf, __eql, __a)
250 template<
typename _InputIterator>
256 template<
typename _InputIterator>
263 template<
typename _InputIterator>
290 #if __glibcxx_containers_ranges // C++ >= 23
304 template<__detail::__container_compatible_range<_Value> _Rg>
310 : _M_h(__n, __hf, __eql, __a)
311 { insert_range(std::forward<_Rg>(__rg)); }
315 template<__detail::__container_compatible_range<_Value> _Rg>
318 { insert_range(std::forward<_Rg>(__rg)); }
320 template<__detail::__container_compatible_range<_Value> _Rg>
324 { insert_range(std::forward<_Rg>(__rg)); }
326 template<__detail::__container_compatible_range<_Value> _Rg>
330 { insert_range(std::forward<_Rg>(__rg)); }
362 {
return _M_h.get_allocator(); }
367 _GLIBCXX_NODISCARD
bool
369 {
return _M_h.empty(); }
374 {
return _M_h.size(); }
379 {
return _M_h.max_size(); }
390 {
return _M_h.begin(); }
394 {
return _M_h.begin(); }
404 {
return _M_h.end(); }
408 {
return _M_h.end(); }
417 {
return _M_h.begin(); }
425 {
return _M_h.end(); }
444 template<
typename... _Args>
447 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
470 template<
typename... _Args>
473 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
491 {
return _M_h.insert(__x); }
497 #if __glibcxx_associative_heterogeneous_insertion // C++26
498 template <__heterogeneous_hash_key<unordered_set> _Kt>
501 {
return _M_h._M_insert_tr(std::forward<_Kt>(__x)); }
527 {
return _M_h.insert(__hint, __x); }
531 {
return _M_h.insert(__hint,
std::move(__x)); }
533 #if __glibcxx_associative_heterogeneous_insertion // C++26
534 template <__heterogeneous_hash_key<unordered_set> _Kt>
537 {
return _M_h._M_insert_tr(std::forward<_Kt>(__x)).first; }
550 template<
typename _InputIterator>
552 insert(_InputIterator __first, _InputIterator __last)
553 { _M_h.insert(__first, __last); }
564 { _M_h.insert(__l); }
566 #if __glibcxx_containers_ranges // C++ >= 23
573 template<__detail::__container_compatible_range<_Value> _Rg>
575 insert_range(_Rg&& __rg)
577 auto __first = ranges::begin(__rg);
578 const auto __last = ranges::end(__rg);
579 for (; __first != __last; ++__first)
580 _M_h.emplace(*__first);
584 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
589 __glibcxx_assert(__pos !=
end());
590 return _M_h.extract(__pos);
596 {
return _M_h.extract(__key); }
598 #ifdef __glibcxx_associative_heterogeneous_erasure // C++23
599 template <__heterogeneous_hash_key<unordered_set> _Kt>
602 {
return _M_h._M_extract_tr(__key); }
608 {
return _M_h._M_reinsert_node(
std::move(__nh)); }
613 {
return _M_h._M_reinsert_node(
std::move(__nh)).position; }
614 #endif // node_extract
632 {
return _M_h.erase(__position); }
637 {
return _M_h.erase(__position); }
654 {
return _M_h.erase(__x); }
656 #ifdef __glibcxx_associative_heterogeneous_erasure // C++23
657 template <__heterogeneous_hash_key<unordered_set> _Kt>
660 {
return _M_h._M_erase_tr(__key); }
679 {
return _M_h.erase(__first, __last); }
702 noexcept( noexcept(_M_h.swap(__x._M_h)) )
703 { _M_h.swap(__x._M_h); }
705 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
706 template<
typename,
typename,
typename>
707 friend class std::_Hash_merge_helper;
709 template<
typename _H2,
typename _P2>
713 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
717 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
718 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
721 template<
typename _H2,
typename _P2>
723 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
725 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
726 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
729 template<
typename _H2,
typename _P2>
731 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source)
733 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
734 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
737 template<
typename _H2,
typename _P2>
739 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
741 #endif // node_extract
749 {
return _M_h.hash_function(); }
755 {
return _M_h.key_eq(); }
773 {
return _M_h.find(__x); }
775 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
776 template<
typename _Kt>
779 -> decltype(_M_h._M_find_tr(__x))
780 {
return _M_h._M_find_tr(__x); }
785 {
return _M_h.find(__x); }
787 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
788 template<
typename _Kt>
791 -> decltype(_M_h._M_find_tr(__x))
792 {
return _M_h._M_find_tr(__x); }
808 {
return _M_h.count(__x); }
810 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
811 template<
typename _Kt>
814 -> decltype(_M_h._M_count_tr(__x))
815 {
return _M_h._M_count_tr(__x); }
819 #if __cplusplus > 201703L
828 {
return _M_h.find(__x) != _M_h.end(); }
830 template<
typename _Kt>
833 -> decltype(_M_h._M_find_tr(__x),
void(),
true)
834 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
849 {
return _M_h.equal_range(__x); }
851 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
852 template<
typename _Kt>
855 -> decltype(_M_h._M_equal_range_tr(__x))
856 {
return _M_h._M_equal_range_tr(__x); }
861 {
return _M_h.equal_range(__x); }
863 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
864 template<
typename _Kt>
867 -> decltype(_M_h._M_equal_range_tr(__x))
868 {
return _M_h._M_equal_range_tr(__x); }
877 {
return _M_h.bucket_count(); }
882 {
return _M_h.max_bucket_count(); }
891 {
return _M_h.bucket_size(__n); }
901 {
return _M_h.bucket(__key); }
903 #if __glibcxx_associative_heterogeneous_insertion // C++26
904 template <__heterogeneous_hash_key<unordered_set> _Kt>
906 bucket(
const _Kt& __key)
const
907 {
return _M_h._M_bucket_tr(__key); }
920 {
return _M_h.begin(__n); }
924 {
return _M_h.begin(__n); }
928 {
return _M_h.cbegin(__n); }
940 {
return _M_h.end(__n); }
944 {
return _M_h.end(__n); }
948 {
return _M_h.cend(__n); }
956 {
return _M_h.load_factor(); }
962 {
return _M_h.max_load_factor(); }
970 { _M_h.max_load_factor(__z); }
981 { _M_h.rehash(__n); }
992 { _M_h.reserve(__n); }
994 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1001 #if __cpp_deduction_guides >= 201606
1003 template<
typename _InputIterator,
1005 hash<typename iterator_traits<_InputIterator>::value_type>,
1007 equal_to<typename iterator_traits<_InputIterator>::value_type>,
1008 typename _Allocator =
1009 allocator<typename iterator_traits<_InputIterator>::value_type>,
1010 typename = _RequireInputIter<_InputIterator>,
1011 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1012 typename = _RequireNotAllocator<_Pred>,
1013 typename = _RequireAllocator<_Allocator>>
1014 unordered_set(_InputIterator, _InputIterator,
1016 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1017 -> unordered_set<
typename iterator_traits<_InputIterator>::value_type,
1018 _Hash, _Pred, _Allocator>;
1020 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1021 typename _Pred = equal_to<_Tp>,
1022 typename _Allocator = allocator<_Tp>,
1023 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1024 typename = _RequireNotAllocator<_Pred>,
1025 typename = _RequireAllocator<_Allocator>>
1026 unordered_set(initializer_list<_Tp>,
1028 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1029 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
1031 template<
typename _InputIterator,
typename _Allocator,
1032 typename = _RequireInputIter<_InputIterator>,
1033 typename = _RequireAllocator<_Allocator>>
1034 unordered_set(_InputIterator, _InputIterator,
1038 typename iterator_traits<_InputIterator>::value_type>,
1040 typename iterator_traits<_InputIterator>::value_type>,
1045 template<
typename _InputIterator,
typename _Allocator,
1046 typename = _RequireInputIter<_InputIterator>,
1047 typename = _RequireAllocator<_Allocator>>
1048 unordered_set(_InputIterator, _InputIterator, _Allocator)
1051 typename iterator_traits<_InputIterator>::value_type>,
1053 typename iterator_traits<_InputIterator>::value_type>,
1056 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1057 typename = _RequireInputIter<_InputIterator>,
1058 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1059 typename = _RequireAllocator<_Allocator>>
1060 unordered_set(_InputIterator, _InputIterator,
1066 typename iterator_traits<_InputIterator>::value_type>,
1069 template<
typename _Tp,
typename _Allocator,
1070 typename = _RequireAllocator<_Allocator>>
1071 unordered_set(initializer_list<_Tp>,
1073 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1077 template<
typename _Tp,
typename _Allocator,
1078 typename = _RequireAllocator<_Allocator>>
1079 unordered_set(initializer_list<_Tp>, _Allocator)
1080 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1082 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1083 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1084 typename = _RequireAllocator<_Allocator>>
1085 unordered_set(initializer_list<_Tp>,
1087 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
1089 #if __glibcxx_containers_ranges // C++ >= 23
1090 template<ranges::input_range _Rg,
1091 __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>,
1092 __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>,
1093 __allocator_like _Allocator = allocator<ranges::range_value_t<_Rg>>>
1095 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1096 -> unordered_set<ranges::range_value_t<_Rg>, _Hash, _Pred, _Allocator>;
1098 template<ranges::input_range _Rg,
1099 __allocator_like _Allocator>
1102 -> unordered_set<ranges::range_value_t<_Rg>,
1103 hash<ranges::range_value_t<_Rg>>,
1104 equal_to<ranges::range_value_t<_Rg>>,
1107 template<ranges::input_range _Rg,
1108 __allocator_like _Allocator>
1109 unordered_set(from_range_t, _Rg&&, _Allocator)
1110 -> unordered_set<ranges::range_value_t<_Rg>,
1111 hash<ranges::range_value_t<_Rg>>,
1112 equal_to<ranges::range_value_t<_Rg>>,
1115 template<ranges::input_range _Rg,
1116 __not_allocator_like _Hash,
1117 __allocator_like _Allocator>
1120 -> unordered_set<ranges::range_value_t<_Rg>, _Hash,
1121 equal_to<ranges::range_value_t<_Rg>>,
1147 template<
typename _Value,
1148 typename _Hash = hash<_Value>,
1149 typename _Pred = equal_to<_Value>,
1150 typename _Alloc = allocator<_Value>>
1151 class unordered_multiset
1153 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
1181 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
1182 using node_type =
typename _Hashtable::node_type;
1202 : _M_h(__n, __hf, __eql, __a)
1218 template<
typename _InputIterator>
1224 : _M_h(__first, __last, __n, __hf, __eql, __a)
1249 : _M_h(__l, __n, __hf, __eql, __a)
1276 : _M_h(__umset._M_h, __a)
1286 noexcept( noexcept(_Hashtable(
std::move(__umset._M_h), __a)) )
1287 : _M_h(
std::
move(__umset._M_h), __a)
1301 template<
typename _InputIterator>
1307 template<
typename _InputIterator>
1314 template<
typename _InputIterator>
1340 #if __glibcxx_containers_ranges // C++ >= 23
1354 template<__detail::__container_compatible_range<_Value> _Rg>
1360 : _M_h(__n, __hf, __eql, __a)
1361 { insert_range(std::forward<_Rg>(__rg)); }
1366 template<__detail::__container_compatible_range<_Value> _Rg>
1369 { insert_range(std::forward<_Rg>(__rg)); }
1371 template<__detail::__container_compatible_range<_Value> _Rg>
1375 { insert_range(std::forward<_Rg>(__rg)); }
1377 template<__detail::__container_compatible_range<_Value> _Rg>
1381 { insert_range(std::forward<_Rg>(__rg)); }
1406 {
return _M_h.get_allocator(); }
1411 _GLIBCXX_NODISCARD
bool
1413 {
return _M_h.empty(); }
1418 {
return _M_h.size(); }
1423 {
return _M_h.max_size(); }
1434 {
return _M_h.begin(); }
1438 {
return _M_h.begin(); }
1448 {
return _M_h.end(); }
1452 {
return _M_h.end(); }
1461 {
return _M_h.begin(); }
1469 {
return _M_h.end(); }
1480 template<
typename... _Args>
1483 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1502 template<
typename... _Args>
1505 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1517 {
return _M_h.insert(__x); }
1543 {
return _M_h.insert(__hint, __x); }
1547 {
return _M_h.insert(__hint,
std::move(__x)); }
1558 template<
typename _InputIterator>
1560 insert(_InputIterator __first, _InputIterator __last)
1561 { _M_h.insert(__first, __last); }
1572 { _M_h.insert(__l); }
1574 #if __glibcxx_containers_ranges // C++ >= 23
1581 template<__detail::__container_compatible_range<_Value> _Rg>
1583 insert_range(_Rg&& __rg)
1585 auto __first = ranges::begin(__rg);
1586 const auto __last = ranges::end(__rg);
1587 if (__first == __last)
1590 if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>)
1591 _M_h._M_rehash_insert(
size_type(ranges::distance(__rg)));
1593 _M_h._M_rehash_insert(1);
1595 for (; __first != __last; ++__first)
1596 _M_h.emplace(*__first);
1600 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
1605 __glibcxx_assert(__pos !=
end());
1606 return _M_h.extract(__pos);
1612 {
return _M_h.extract(__key); }
1614 #ifdef __glibcxx_associative_heterogeneous_erasure // C++23
1615 template <__heterogeneous_hash_key<unordered_multiset> _Kt>
1618 {
return _M_h._M_extract_tr(__key); }
1624 {
return _M_h._M_reinsert_node_multi(
cend(),
std::move(__nh)); }
1629 {
return _M_h._M_reinsert_node_multi(__hint,
std::move(__nh)); }
1630 #endif // node_extract
1649 {
return _M_h.erase(__position); }
1654 {
return _M_h.erase(__position); }
1672 {
return _M_h.erase(__x); }
1674 #ifdef __glibcxx_associative_heterogeneous_erasure // C++23
1675 template <__heterogeneous_hash_key<unordered_multiset> _Kt>
1678 {
return _M_h._M_erase_tr(__key); }
1699 {
return _M_h.erase(__first, __last); }
1723 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1724 { _M_h.swap(__x._M_h); }
1726 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
1727 template<
typename,
typename,
typename>
1728 friend class std::_Hash_merge_helper;
1730 template<
typename _H2,
typename _P2>
1734 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
1739 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1740 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1743 template<
typename _H2,
typename _P2>
1745 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
1748 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1749 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1752 template<
typename _H2,
typename _P2>
1754 merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source)
1757 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1758 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1761 template<
typename _H2,
typename _P2>
1763 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
1764 { merge(__source); }
1765 #endif // node_extract
1773 {
return _M_h.hash_function(); }
1779 {
return _M_h.key_eq(); }
1797 {
return _M_h.find(__x); }
1799 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
1800 template<
typename _Kt>
1803 -> decltype(_M_h._M_find_tr(__x))
1804 {
return _M_h._M_find_tr(__x); }
1809 {
return _M_h.find(__x); }
1811 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
1812 template<
typename _Kt>
1815 -> decltype(_M_h._M_find_tr(__x))
1816 {
return _M_h._M_find_tr(__x); }
1828 {
return _M_h.count(__x); }
1830 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
1831 template<
typename _Kt>
1833 count(
const _Kt& __x)
const -> decltype(_M_h._M_count_tr(__x))
1834 {
return _M_h._M_count_tr(__x); }
1838 #if __cplusplus > 201703L
1847 {
return _M_h.find(__x) != _M_h.end(); }
1849 template<
typename _Kt>
1852 -> decltype(_M_h._M_find_tr(__x),
void(),
true)
1853 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
1866 {
return _M_h.equal_range(__x); }
1868 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
1869 template<
typename _Kt>
1872 -> decltype(_M_h._M_equal_range_tr(__x))
1873 {
return _M_h._M_equal_range_tr(__x); }
1878 {
return _M_h.equal_range(__x); }
1880 #ifdef __glibcxx_generic_unordered_lookup // C++ >= 20 && HOSTED
1881 template<
typename _Kt>
1884 -> decltype(_M_h._M_equal_range_tr(__x))
1885 {
return _M_h._M_equal_range_tr(__x); }
1894 {
return _M_h.bucket_count(); }
1899 {
return _M_h.max_bucket_count(); }
1908 {
return _M_h.bucket_size(__n); }
1917 bucket(
const key_type& __key)
const
1918 {
return _M_h.bucket(__key); }
1920 #if __glibcxx_associative_heterogeneous_insertion // C++26
1921 template <__heterogeneous_hash_key<unordered_multiset> _Kt>
1923 bucket(
const _Kt& __key)
const
1924 {
return _M_h._M_bucket_tr(__key); }
1937 {
return _M_h.begin(__n); }
1941 {
return _M_h.begin(__n); }
1945 {
return _M_h.cbegin(__n); }
1957 {
return _M_h.end(__n); }
1961 {
return _M_h.end(__n); }
1965 {
return _M_h.cend(__n); }
1973 {
return _M_h.load_factor(); }
1979 {
return _M_h.max_load_factor(); }
1987 { _M_h.max_load_factor(__z); }
1998 { _M_h.rehash(__n); }
2009 { _M_h.reserve(__n); }
2011 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
2019 #if __cpp_deduction_guides >= 201606
2021 template<
typename _InputIterator,
2023 hash<typename iterator_traits<_InputIterator>::value_type>,
2025 equal_to<typename iterator_traits<_InputIterator>::value_type>,
2026 typename _Allocator =
2027 allocator<typename iterator_traits<_InputIterator>::value_type>,
2028 typename = _RequireInputIter<_InputIterator>,
2029 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2030 typename = _RequireNotAllocator<_Pred>,
2031 typename = _RequireAllocator<_Allocator>>
2032 unordered_multiset(_InputIterator, _InputIterator,
2034 _Hash = _Hash(), _Pred = _Pred(),
2035 _Allocator = _Allocator())
2036 -> unordered_multiset<
typename iterator_traits<_InputIterator>::value_type,
2037 _Hash, _Pred, _Allocator>;
2039 template<
typename _Tp,
typename _Hash = hash<_Tp>,
2040 typename _Pred = equal_to<_Tp>,
2041 typename _Allocator = allocator<_Tp>,
2042 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2043 typename = _RequireNotAllocator<_Pred>,
2044 typename = _RequireAllocator<_Allocator>>
2045 unordered_multiset(initializer_list<_Tp>,
2047 _Hash = _Hash(), _Pred = _Pred(),
2048 _Allocator = _Allocator())
2049 -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
2051 template<
typename _InputIterator,
typename _Allocator,
2052 typename = _RequireInputIter<_InputIterator>,
2053 typename = _RequireAllocator<_Allocator>>
2054 unordered_multiset(_InputIterator, _InputIterator,
2058 iterator_traits<_InputIterator>::value_type>,
2060 iterator_traits<_InputIterator>::value_type>,
2065 template<
typename _InputIterator,
typename _Allocator,
2066 typename = _RequireInputIter<_InputIterator>,
2067 typename = _RequireAllocator<_Allocator>>
2068 unordered_multiset(_InputIterator, _InputIterator, _Allocator)
2071 iterator_traits<_InputIterator>::value_type>,
2073 iterator_traits<_InputIterator>::value_type>,
2076 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
2077 typename = _RequireInputIter<_InputIterator>,
2078 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2079 typename = _RequireAllocator<_Allocator>>
2080 unordered_multiset(_InputIterator, _InputIterator,
2083 -> unordered_multiset<
typename
2084 iterator_traits<_InputIterator>::value_type,
2088 iterator_traits<_InputIterator>::value_type>,
2091 template<
typename _Tp,
typename _Allocator,
2092 typename = _RequireAllocator<_Allocator>>
2093 unordered_multiset(initializer_list<_Tp>,
2095 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
2099 template<
typename _Tp,
typename _Allocator,
2100 typename = _RequireAllocator<_Allocator>>
2101 unordered_multiset(initializer_list<_Tp>, _Allocator)
2102 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
2104 template<
typename _Tp,
typename _Hash,
typename _Allocator,
2105 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2106 typename = _RequireAllocator<_Allocator>>
2107 unordered_multiset(initializer_list<_Tp>,
2109 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
2111 #if __glibcxx_containers_ranges // C++ >= 23
2112 template<ranges::input_range _Rg,
2113 __not_allocator_like _Hash = hash<ranges::range_value_t<_Rg>>,
2114 __not_allocator_like _Pred = equal_to<ranges::range_value_t<_Rg>>,
2115 __allocator_like _Allocator = allocator<ranges::range_value_t<_Rg>>>
2116 unordered_multiset(from_range_t, _Rg&&,
2118 _Hash = _Hash(), _Pred = _Pred(),
2119 _Allocator = _Allocator())
2120 -> unordered_multiset<ranges::range_value_t<_Rg>, _Hash, _Pred, _Allocator>;
2122 template<ranges::input_range _Rg,
2123 __allocator_like _Allocator>
2124 unordered_multiset(from_range_t, _Rg&&, _Allocator)
2125 -> unordered_multiset<ranges::range_value_t<_Rg>,
2126 hash<ranges::range_value_t<_Rg>>,
2127 equal_to<ranges::range_value_t<_Rg>>,
2130 template<ranges::input_range _Rg,
2131 __allocator_like _Allocator>
2134 -> unordered_multiset<ranges::range_value_t<_Rg>,
2135 hash<ranges::range_value_t<_Rg>>,
2136 equal_to<ranges::range_value_t<_Rg>>,
2139 template<ranges::input_range _Rg,
2140 __not_allocator_like _Hash,
2141 __allocator_like _Allocator>
2142 unordered_multiset(from_range_t, _Rg&&,
2145 -> unordered_multiset<ranges::range_value_t<_Rg>, _Hash,
2146 equal_to<ranges::range_value_t<_Rg>>,
2151 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2153 swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
2154 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
2155 noexcept(noexcept(__x.swap(__y)))
2158 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2160 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
2161 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
2162 noexcept(noexcept(__x.swap(__y)))
2165 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2167 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
2168 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
2169 {
return __x._M_h._M_equal(__y._M_h); }
2171 #if __cpp_impl_three_way_comparison < 201907L
2172 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2174 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
2175 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
2176 {
return !(__x == __y); }
2179 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2181 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
2182 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
2183 {
return __x._M_h._M_equal(__y._M_h); }
2185 #if __cpp_impl_three_way_comparison < 201907L
2186 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2188 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
2189 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
2190 {
return !(__x == __y); }
2193 _GLIBCXX_END_NAMESPACE_CONTAINER
2195 #ifdef __glibcxx_node_extract // >= C++17 && HOSTED
2197 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2198 typename _Hash2,
typename _Eq2>
2199 struct _Hash_merge_helper<
2200 _GLIBCXX_STD_C::unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
2203 template<
typename... _Tp>
2204 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2205 template<
typename... _Tp>
2206 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2208 friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>;
2211 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2212 {
return __set._M_h; }
2215 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2216 {
return __set._M_h; }
2220 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2221 typename _Hash2,
typename _Eq2>
2222 struct _Hash_merge_helper<
2223 _GLIBCXX_STD_C::unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>,
2227 template<
typename... _Tp>
2228 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2229 template<
typename... _Tp>
2230 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2232 friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>;
2235 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2236 {
return __set._M_h; }
2239 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2240 {
return __set._M_h; }
2242 #endif // node_extract
2244 _GLIBCXX_END_NAMESPACE_VERSION