30#ifndef _UNORDERED_SET_H
31#define _UNORDERED_SET_H
37#if __glibcxx_containers_ranges
41namespace 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
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)
205 const allocator_type& __a)
206 : _M_h(__uset._M_h, __a)
215 const allocator_type& __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)
244 const allocator_type& __a)
245 : unordered_set(__n, __hf,
key_equal(), __a)
250 template<
typename _InputIterator>
256 template<
typename _InputIterator>
263 template<
typename _InputIterator>
290#if __glibcxx_containers_ranges
304 template<__detail::__container_compatible_range<_Value> _Rg>
310 : _M_h(__n, __hf, __eql, __a)
315 template<__detail::__container_compatible_range<_Value> _Rg>
320 template<__detail::__container_compatible_range<_Value> _Rg>
326 template<__detail::__container_compatible_range<_Value> _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>
470 template<
typename... _Args>
491 {
return _M_h.insert(__x); }
520 {
return _M_h.insert(__hint, __x); }
524 {
return _M_h.insert(__hint,
std::move(__x)); }
536 template<
typename _InputIterator>
538 insert(_InputIterator __first, _InputIterator __last)
539 { _M_h.insert(__first, __last); }
550 { _M_h.insert(__l); }
552#if __glibcxx_containers_ranges
559 template<__detail::__container_compatible_range<_Value> _Rg>
561 insert_range(_Rg&& __rg)
563 auto __first = ranges::begin(__rg);
564 const auto __last = ranges::end(__rg);
565 for (; __first != __last; ++__first)
566 _M_h.emplace(*__first);
570#ifdef __glibcxx_node_extract
573 extract(const_iterator __pos)
575 __glibcxx_assert(__pos !=
end());
576 return _M_h.extract(__pos);
582 {
return _M_h.extract(__key); }
587 {
return _M_h._M_reinsert_node(
std::move(__nh)); }
592 {
return _M_h._M_reinsert_node(
std::move(__nh)).position; }
611 {
return _M_h.erase(__position); }
616 {
return _M_h.erase(__position); }
633 {
return _M_h.erase(__x); }
651 {
return _M_h.erase(__first, __last); }
674 noexcept(
noexcept(_M_h.swap(__x._M_h)) )
675 { _M_h.swap(__x._M_h); }
677#ifdef __glibcxx_node_extract
678 template<
typename,
typename,
typename>
679 friend class std::_Hash_merge_helper;
681 template<
typename _H2,
typename _P2>
685 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
689 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
690 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
693 template<
typename _H2,
typename _P2>
695 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
697 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
698 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
701 template<
typename _H2,
typename _P2>
703 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source)
705 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
706 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
709 template<
typename _H2,
typename _P2>
711 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
721 {
return _M_h.hash_function(); }
727 {
return _M_h.key_eq(); }
745 {
return _M_h.find(__x); }
747#if __cplusplus > 201703L
748 template<
typename _Kt>
751 ->
decltype(_M_h._M_find_tr(__k))
752 {
return _M_h._M_find_tr(__k); }
757 {
return _M_h.find(__x); }
759#if __cplusplus > 201703L
760 template<
typename _Kt>
763 ->
decltype(_M_h._M_find_tr(__k))
764 {
return _M_h._M_find_tr(__k); }
780 {
return _M_h.count(__x); }
782#if __cplusplus > 201703L
783 template<
typename _Kt>
786 ->
decltype(_M_h._M_count_tr(__k))
787 {
return _M_h._M_count_tr(__k); }
791#if __cplusplus > 201703L
800 {
return _M_h.find(__x) != _M_h.end(); }
802 template<
typename _Kt>
805 ->
decltype(_M_h._M_find_tr(__k),
void(),
true)
806 {
return _M_h._M_find_tr(__k) != _M_h.end(); }
821 {
return _M_h.equal_range(__x); }
823#if __cplusplus > 201703L
824 template<
typename _Kt>
827 ->
decltype(_M_h._M_equal_range_tr(__k))
828 {
return _M_h._M_equal_range_tr(__k); }
833 {
return _M_h.equal_range(__x); }
835#if __cplusplus > 201703L
836 template<
typename _Kt>
839 ->
decltype(_M_h._M_equal_range_tr(__k))
840 {
return _M_h._M_equal_range_tr(__k); }
849 {
return _M_h.bucket_count(); }
854 {
return _M_h.max_bucket_count(); }
863 {
return _M_h.bucket_size(__n); }
872 {
return _M_h.bucket(__key); }
883 {
return _M_h.begin(__n); }
887 {
return _M_h.begin(__n); }
891 {
return _M_h.cbegin(__n); }
903 {
return _M_h.end(__n); }
907 {
return _M_h.end(__n); }
911 {
return _M_h.cend(__n); }
919 {
return _M_h.load_factor(); }
925 {
return _M_h.max_load_factor(); }
933 { _M_h.max_load_factor(__z); }
944 { _M_h.rehash(__n); }
955 { _M_h.reserve(__n); }
957 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
964#if __cpp_deduction_guides >= 201606
966 template<
typename _InputIterator,
968 hash<typename iterator_traits<_InputIterator>::value_type>,
970 equal_to<typename iterator_traits<_InputIterator>::value_type>,
971 typename _Allocator =
972 allocator<typename iterator_traits<_InputIterator>::value_type>,
973 typename = _RequireInputIter<_InputIterator>,
974 typename = _RequireNotAllocatorOrIntegral<_Hash>,
975 typename = _RequireNotAllocator<_Pred>,
976 typename = _RequireAllocator<_Allocator>>
977 unordered_set(_InputIterator, _InputIterator,
978 unordered_set<int>::size_type = {},
979 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
981 _Hash, _Pred, _Allocator>;
983 template<
typename _Tp,
typename _Hash = hash<_Tp>,
984 typename _Pred = equal_to<_Tp>,
985 typename _Allocator = allocator<_Tp>,
986 typename = _RequireNotAllocatorOrIntegral<_Hash>,
987 typename = _RequireNotAllocator<_Pred>,
988 typename = _RequireAllocator<_Allocator>>
991 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
994 template<
typename _InputIterator,
typename _Allocator,
995 typename = _RequireInputIter<_InputIterator>,
996 typename = _RequireAllocator<_Allocator>>
1008 template<
typename _InputIterator,
typename _Allocator,
1009 typename = _RequireInputIter<_InputIterator>,
1010 typename = _RequireAllocator<_Allocator>>
1019 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1020 typename = _RequireInputIter<_InputIterator>,
1021 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1022 typename = _RequireAllocator<_Allocator>>
1032 template<
typename _Tp,
typename _Allocator,
1033 typename = _RequireAllocator<_Allocator>>
1040 template<
typename _Tp,
typename _Allocator,
1041 typename = _RequireAllocator<_Allocator>>
1045 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1046 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1047 typename = _RequireAllocator<_Allocator>>
1052#if __glibcxx_containers_ranges
1053 template<ranges::input_range _Rg,
1058 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1059 ->
unordered_set<ranges::range_value_t<_Rg>, _Hash, _Pred, _Allocator>;
1061 template<ranges::input_range _Rg,
1062 __allocator_like _Allocator>
1070 template<ranges::input_range _Rg,
1071 __allocator_like _Allocator>
1078 template<ranges::input_range _Rg,
1079 __not_allocator_like _Hash,
1080 __allocator_like _Allocator>
1110 template<
typename _Value,
1116 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
1144#ifdef __glibcxx_node_extract
1145 using node_type =
typename _Hashtable::node_type;
1165 : _M_h(__n, __hf, __eql, __a)
1181 template<
typename _InputIterator>
1187 : _M_h(__first, __last, __n, __hf, __eql, __a)
1212 : _M_h(__l, __n, __hf, __eql, __a)
1238 const allocator_type& __a)
1239 : _M_h(__umset._M_h, __a)
1248 const allocator_type& __a)
1249 noexcept(
noexcept(_Hashtable(
std::move(__umset._M_h), __a)) )
1250 : _M_h(
std::
move(__umset._M_h), __a)
1264 template<
typename _InputIterator>
1270 template<
typename _InputIterator>
1277 template<
typename _InputIterator>
1303#if __glibcxx_containers_ranges
1317 template<__detail::__container_compatible_range<_Value> _Rg>
1323 : _M_h(__n, __hf, __eql, __a)
1329 template<__detail::__container_compatible_range<_Value> _Rg>
1334 template<__detail::__container_compatible_range<_Value> _Rg>
1340 template<__detail::__container_compatible_range<_Value> _Rg>
1369 {
return _M_h.get_allocator(); }
1374 _GLIBCXX_NODISCARD
bool
1376 {
return _M_h.empty(); }
1381 {
return _M_h.size(); }
1386 {
return _M_h.max_size(); }
1397 {
return _M_h.begin(); }
1401 {
return _M_h.begin(); }
1411 {
return _M_h.end(); }
1415 {
return _M_h.end(); }
1424 {
return _M_h.begin(); }
1432 {
return _M_h.end(); }
1443 template<
typename... _Args>
1465 template<
typename... _Args>
1480 {
return _M_h.insert(__x); }
1506 {
return _M_h.insert(__hint, __x); }
1510 {
return _M_h.insert(__hint,
std::move(__x)); }
1521 template<
typename _InputIterator>
1523 insert(_InputIterator __first, _InputIterator __last)
1524 { _M_h.insert(__first, __last); }
1535 { _M_h.insert(__l); }
1537#if __glibcxx_containers_ranges
1544 template<__detail::__container_compatible_range<_Value> _Rg>
1546 insert_range(_Rg&& __rg)
1548 auto __first = ranges::begin(__rg);
1549 const auto __last = ranges::end(__rg);
1550 if (__first == __last)
1553 if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>)
1554 _M_h._M_rehash_insert(
size_type(ranges::distance(__rg)));
1556 _M_h._M_rehash_insert(1);
1558 for (; __first != __last; ++__first)
1559 _M_h.emplace(*__first);
1563#ifdef __glibcxx_node_extract
1566 extract(const_iterator __pos)
1568 __glibcxx_assert(__pos !=
end());
1569 return _M_h.extract(__pos);
1575 {
return _M_h.extract(__key); }
1580 {
return _M_h._M_reinsert_node_multi(
cend(),
std::move(__nh)); }
1585 {
return _M_h._M_reinsert_node_multi(__hint,
std::move(__nh)); }
1605 {
return _M_h.erase(__position); }
1610 {
return _M_h.erase(__position); }
1628 {
return _M_h.erase(__x); }
1648 {
return _M_h.erase(__first, __last); }
1672 noexcept(
noexcept(_M_h.swap(__x._M_h)) )
1673 { _M_h.swap(__x._M_h); }
1675#ifdef __glibcxx_node_extract
1676 template<
typename,
typename,
typename>
1677 friend class std::_Hash_merge_helper;
1679 template<
typename _H2,
typename _P2>
1683 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
1688 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1689 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1692 template<
typename _H2,
typename _P2>
1694 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
1697 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1698 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1701 template<
typename _H2,
typename _P2>
1703 merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source)
1706 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1707 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1710 template<
typename _H2,
typename _P2>
1712 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
1713 { merge(__source); }
1722 {
return _M_h.hash_function(); }
1728 {
return _M_h.key_eq(); }
1746 {
return _M_h.find(__x); }
1748#if __cplusplus > 201703L
1749 template<
typename _Kt>
1752 ->
decltype(_M_h._M_find_tr(__x))
1753 {
return _M_h._M_find_tr(__x); }
1758 {
return _M_h.find(__x); }
1760#if __cplusplus > 201703L
1761 template<
typename _Kt>
1764 ->
decltype(_M_h._M_find_tr(__x))
1765 {
return _M_h._M_find_tr(__x); }
1777 {
return _M_h.count(__x); }
1779#if __cplusplus > 201703L
1780 template<
typename _Kt>
1782 count(
const _Kt& __x)
const ->
decltype(_M_h._M_count_tr(__x))
1783 {
return _M_h._M_count_tr(__x); }
1787#if __cplusplus > 201703L
1796 {
return _M_h.find(__x) != _M_h.end(); }
1798 template<
typename _Kt>
1801 ->
decltype(_M_h._M_find_tr(__x),
void(),
true)
1802 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
1815 {
return _M_h.equal_range(__x); }
1817#if __cplusplus > 201703L
1818 template<
typename _Kt>
1821 ->
decltype(_M_h._M_equal_range_tr(__x))
1822 {
return _M_h._M_equal_range_tr(__x); }
1827 {
return _M_h.equal_range(__x); }
1829#if __cplusplus > 201703L
1830 template<
typename _Kt>
1833 ->
decltype(_M_h._M_equal_range_tr(__x))
1834 {
return _M_h._M_equal_range_tr(__x); }
1843 {
return _M_h.bucket_count(); }
1848 {
return _M_h.max_bucket_count(); }
1857 {
return _M_h.bucket_size(__n); }
1865 bucket(
const key_type& __key)
const
1866 {
return _M_h.bucket(__key); }
1877 {
return _M_h.begin(__n); }
1881 {
return _M_h.begin(__n); }
1885 {
return _M_h.cbegin(__n); }
1897 {
return _M_h.end(__n); }
1901 {
return _M_h.end(__n); }
1905 {
return _M_h.cend(__n); }
1913 {
return _M_h.load_factor(); }
1919 {
return _M_h.max_load_factor(); }
1927 { _M_h.max_load_factor(__z); }
1938 { _M_h.rehash(__n); }
1949 { _M_h.reserve(__n); }
1951 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1959#if __cpp_deduction_guides >= 201606
1961 template<
typename _InputIterator,
1963 hash<typename iterator_traits<_InputIterator>::value_type>,
1965 equal_to<typename iterator_traits<_InputIterator>::value_type>,
1966 typename _Allocator =
1967 allocator<typename iterator_traits<_InputIterator>::value_type>,
1968 typename = _RequireInputIter<_InputIterator>,
1969 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1970 typename = _RequireNotAllocator<_Pred>,
1971 typename = _RequireAllocator<_Allocator>>
1972 unordered_multiset(_InputIterator, _InputIterator,
1973 unordered_multiset<int>::size_type = {},
1974 _Hash = _Hash(), _Pred = _Pred(),
1975 _Allocator = _Allocator())
1977 _Hash, _Pred, _Allocator>;
1979 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1980 typename _Pred = equal_to<_Tp>,
1981 typename _Allocator = allocator<_Tp>,
1982 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1983 typename = _RequireNotAllocator<_Pred>,
1984 typename = _RequireAllocator<_Allocator>>
1987 _Hash = _Hash(), _Pred = _Pred(),
1988 _Allocator = _Allocator())
1991 template<
typename _InputIterator,
typename _Allocator,
1992 typename = _RequireInputIter<_InputIterator>,
1993 typename = _RequireAllocator<_Allocator>>
2005 template<
typename _InputIterator,
typename _Allocator,
2006 typename = _RequireInputIter<_InputIterator>,
2007 typename = _RequireAllocator<_Allocator>>
2016 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
2017 typename = _RequireInputIter<_InputIterator>,
2018 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2019 typename = _RequireAllocator<_Allocator>>
2031 template<
typename _Tp,
typename _Allocator,
2032 typename = _RequireAllocator<_Allocator>>
2039 template<
typename _Tp,
typename _Allocator,
2040 typename = _RequireAllocator<_Allocator>>
2044 template<
typename _Tp,
typename _Hash,
typename _Allocator,
2045 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2046 typename = _RequireAllocator<_Allocator>>
2051#if __glibcxx_containers_ranges
2052 template<ranges::input_range _Rg,
2058 _Hash = _Hash(), _Pred = _Pred(),
2059 _Allocator = _Allocator())
2062 template<ranges::input_range _Rg,
2063 __allocator_like _Allocator>
2070 template<ranges::input_range _Rg,
2071 __allocator_like _Allocator>
2079 template<ranges::input_range _Rg,
2080 __not_allocator_like _Hash,
2081 __allocator_like _Allocator>
2091 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2095 noexcept(
noexcept(__x.swap(__y)))
2098 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2102 noexcept(
noexcept(__x.swap(__y)))
2105 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2109 {
return __x._M_h._M_equal(__y._M_h); }
2111#if __cpp_impl_three_way_comparison < 201907L
2112 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2116 {
return !(__x == __y); }
2119 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2123 {
return __x._M_h._M_equal(__y._M_h); }
2125#if __cpp_impl_three_way_comparison < 201907L
2126 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2130 {
return !(__x == __y); }
2133_GLIBCXX_END_NAMESPACE_CONTAINER
2135#ifdef __glibcxx_node_extract
2137 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2138 typename _Hash2,
typename _Eq2>
2139 struct _Hash_merge_helper<
2140 _GLIBCXX_STD_C::
unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
2143 template<
typename... _Tp>
2144 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2145 template<
typename... _Tp>
2146 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2148 friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>;
2151 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2152 {
return __set._M_h; }
2155 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2156 {
return __set._M_h; }
2160 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2161 typename _Hash2,
typename _Eq2>
2162 struct _Hash_merge_helper<
2167 template<
typename... _Tp>
2168 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2169 template<
typename... _Tp>
2170 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2172 friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>;
2175 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2176 {
return __set._M_h; }
2179 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2180 {
return __set._M_h; }
2184_GLIBCXX_END_NAMESPACE_VERSION
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr _Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.
__detail::_Hashtable_traits< _Cache, true, false > __umset_traits
Base types for unordered_multiset.
__detail::_Hashtable_traits< _Cache, true, true > __uset_traits
Base types for unordered_set.
Primary class template hash.
The standard allocator, as per C++03 [20.4.1].
One of the comparison functors.
Struct holding two objects of arbitrary type.
Traits class for iterators.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
auto find(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x))
Tries to locate an element in an unordered_multiset.
iterator begin() noexcept
auto find(const _Kt &__x) -> decltype(_M_h._M_find_tr(__x))
Tries to locate an element in an unordered_multiset.
iterator insert(const_iterator __hint, const value_type &__x)
Inserts an element into the unordered_multiset.
_Hashtable::difference_type difference_type
void insert(initializer_list< value_type > __l)
Inserts a list of elements into the unordered_multiset.
_Hashtable::pointer pointer
bool contains(const key_type &__x) const
Finds whether an element with the given key exists.
void rehash(size_type __n)
May rehash the unordered_multiset.
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multiset.
float max_load_factor() const noexcept
Returns a positive number that the unordered_multiset tries to keep the load factor less than or equa...
bool empty() const noexcept
Returns true if the unordered_multiset is empty.
const_iterator cend() const noexcept
_Hashtable::local_iterator local_iterator
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
iterator emplace(_Args &&... __args)
Builds and insert an element into the unordered_multiset.
unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_multiset from a range.
_Hashtable::const_iterator const_iterator
unordered_multiset(const allocator_type &__a)
Creates an unordered_multiset with no elements.
_Hashtable::allocator_type allocator_type
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
iterator find(const key_type &__x)
Tries to locate an element in an unordered_multiset.
_Hashtable::value_type value_type
unordered_multiset & operator=(unordered_multiset &&)=default
Move assignment operator.
float load_factor() const noexcept
Returns the average number of elements per bucket.
unordered_multiset()=default
Default constructor.
_Hashtable::size_type size_type
auto equal_range(const _Kt &__x) -> decltype(_M_h._M_equal_range_tr(__x))
Finds a subsequence matching given key.
_Hashtable::key_type key_type
unordered_multiset & operator=(const unordered_multiset &)=default
Copy assignment operator.
hasher hash_function() const
Returns the hash functor object with which the unordered_multiset was constructed.
unordered_multiset(initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_multiset from an initializer_list.
auto contains(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x), void(), true)
Finds whether an element with the given key exists.
auto count(const _Kt &__x) const -> decltype(_M_h._M_count_tr(__x))
Finds the number of elements.
size_type count(const key_type &__x) const
Finds the number of elements.
iterator erase(const_iterator __position)
Erases an element from an unordered_multiset.
unordered_multiset(unordered_multiset &&)=default
Move constructor.
_Hashtable::reference reference
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Inserts an element into the unordered_multiset.
void swap(unordered_multiset &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_multiset.
const_iterator begin() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_multiset.
const_iterator cbegin() const noexcept
void insert(_InputIterator __first, _InputIterator __last)
A template function that inserts a range of elements.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
key_equal key_eq() const
Returns the key comparison object with which the unordered_multiset was constructed.
_Hashtable::const_pointer const_pointer
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
iterator insert(value_type &&__x)
Inserts an element into the unordered_multiset.
iterator insert(const value_type &__x)
Inserts an element into the unordered_multiset.
const_iterator end() const noexcept
void reserve(size_type __n)
Prepare the unordered_multiset for a specified number of elements.
iterator insert(const_iterator __hint, value_type &&__x)
Inserts an element into the unordered_multiset.
_Hashtable::const_reference const_reference
iterator erase(iterator __position)
Erases an element from an unordered_multiset.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multiset.
_Hashtable::hasher hasher
unordered_multiset(size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements.
unordered_multiset & operator=(initializer_list< value_type > __l)
Unordered_multiset list assignment operator.
size_type size() const noexcept
Returns the size of the unordered_multiset.
_Hashtable::iterator iterator
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
auto equal_range(const _Kt &__x) const -> decltype(_M_h._M_equal_range_tr(__x))
Finds a subsequence matching given key.
size_type max_size() const noexcept
Returns the maximum size of the unordered_multiset.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
unordered_multiset(const unordered_multiset &)=default
Copy constructor.
_Hashtable::const_local_iterator const_local_iterator
size_type erase(const key_type &__x)
Erases elements according to the provided key.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_multiset.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_multiset.
_Hashtable::key_equal key_equal
void max_load_factor(float __z)
Change the unordered_multiset maximum load factor.
A standard container composed of unique keys (containing at most one of each key value) in which the ...
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the unordered_set.
_Hashtable::iterator iterator
unordered_set(initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_set from an initializer_list.
void max_load_factor(float __z)
Change the unordered_set maximum load factor.
_Hashtable::reference reference
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
_Hashtable::value_type value_type
const_iterator cend() const noexcept
auto find(const _Kt &__k) -> decltype(_M_h._M_find_tr(__k))
Tries to locate an element in an unordered_set.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_set.
_Hashtable::key_type key_type
size_type count(const key_type &__x) const
Finds the number of elements.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
auto equal_range(const _Kt &__k) -> decltype(_M_h._M_equal_range_tr(__k))
Finds a subsequence matching given key.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
auto count(const _Kt &__k) const -> decltype(_M_h._M_count_tr(__k))
Finds the number of elements.
const_iterator begin() const noexcept
_Hashtable::hasher hasher
_Hashtable::local_iterator local_iterator
_Hashtable::size_type size_type
const_iterator cbegin() const noexcept
bool empty() const noexcept
Returns true if the unordered_set is empty.
unordered_set & operator=(initializer_list< value_type > __l)
Unordered_set list assignment operator.
iterator erase(iterator __position)
Erases an element from an unordered_set.
unordered_set(unordered_set &&)=default
Move constructor.
unordered_set(const allocator_type &__a)
Creates an unordered_set with no elements.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
auto contains(const _Kt &__k) const -> decltype(_M_h._M_find_tr(__k), void(), true)
Finds whether an element with the given key exists.
_Hashtable::const_pointer const_pointer
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
void swap(unordered_set &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_set.
iterator insert(const_iterator __hint, const value_type &__x)
Attempts to insert an element into the unordered_set.
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert an element into the unordered_set.
float load_factor() const noexcept
Returns the average number of elements per bucket.
void rehash(size_type __n)
May rehash the unordered_set.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
_Hashtable::key_equal key_equal
size_type size() const noexcept
Returns the size of the unordered_set.
_Hashtable::const_iterator const_iterator
_Hashtable::difference_type difference_type
_Hashtable::const_reference const_reference
hasher hash_function() const
Returns the hash functor object with which the unordered_set was constructed.
unordered_set(const unordered_set &)=default
Copy constructor.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
auto find(const _Kt &__k) const -> decltype(_M_h._M_find_tr(__k))
Tries to locate an element in an unordered_set.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to insert an element into the unordered_set.
key_equal key_eq() const
Returns the key comparison object with which the unordered_set was constructed.
_Hashtable::allocator_type allocator_type
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert an element into the unordered_set.
const_iterator end() const noexcept
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
unordered_set()=default
Default constructor.
unordered_set & operator=(unordered_set &&)=default
Move assignment operator.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
float max_load_factor() const noexcept
Returns a positive number that the unordered_set tries to keep the load factor less than or equal to.
bool contains(const key_type &__x) const
Finds whether an element with the given key exists.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert an element into the unordered_set.
unordered_set & operator=(const unordered_set &)=default
Copy assignment operator.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
unordered_set(size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_set.
iterator erase(const_iterator __position)
Erases an element from an unordered_set.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_set.
auto equal_range(const _Kt &__k) const -> decltype(_M_h._M_equal_range_tr(__k))
Finds a subsequence matching given key.
_Hashtable::const_local_iterator const_local_iterator
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_set.
unordered_set(_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Builds an unordered_set from a range.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_set.
void reserve(size_type __n)
Prepare the unordered_set for a specified number of elements.
_Hashtable::pointer pointer
iterator begin() noexcept
iterator find(const key_type &__x)
Tries to locate an element in an unordered_set.
size_type max_size() const noexcept
Returns the maximum size of the unordered_set.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_set.