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)
248 template<
typename _InputIterator>
255 template<
typename _InputIterator>
274#if __glibcxx_containers_ranges
288 template<__detail::__container_compatible_range<_Value> _Rg>
294 : _M_h(__n, __hf, __eql, __a)
299 template<__detail::__container_compatible_range<_Value> _Rg>
304 template<__detail::__container_compatible_range<_Value> _Rg>
310 template<__detail::__container_compatible_range<_Value> _Rg>
346 {
return _M_h.get_allocator(); }
351 _GLIBCXX_NODISCARD
bool
353 {
return _M_h.empty(); }
358 {
return _M_h.size(); }
363 {
return _M_h.max_size(); }
374 {
return _M_h.begin(); }
378 {
return _M_h.begin(); }
388 {
return _M_h.end(); }
392 {
return _M_h.end(); }
401 {
return _M_h.begin(); }
409 {
return _M_h.end(); }
428 template<
typename... _Args>
454 template<
typename... _Args>
475 {
return _M_h.insert(__x); }
504 {
return _M_h.insert(__hint, __x); }
508 {
return _M_h.insert(__hint,
std::move(__x)); }
520 template<
typename _InputIterator>
522 insert(_InputIterator __first, _InputIterator __last)
523 { _M_h.insert(__first, __last); }
534 { _M_h.insert(__l); }
536#if __glibcxx_containers_ranges
543 template<__detail::__container_compatible_range<_Value> _Rg>
545 insert_range(_Rg&& __rg)
547 auto __first = ranges::begin(__rg);
548 const auto __last = ranges::end(__rg);
549 for (; __first != __last; ++__first)
550 _M_h.emplace(*__first);
554#ifdef __glibcxx_node_extract
557 extract(const_iterator __pos)
559 __glibcxx_assert(__pos !=
end());
560 return _M_h.extract(__pos);
566 {
return _M_h.extract(__key); }
571 {
return _M_h._M_reinsert_node(
std::move(__nh)); }
576 {
return _M_h._M_reinsert_node(
std::move(__nh)).position; }
595 {
return _M_h.erase(__position); }
600 {
return _M_h.erase(__position); }
617 {
return _M_h.erase(__x); }
635 {
return _M_h.erase(__first, __last); }
658 noexcept(
noexcept(_M_h.swap(__x._M_h)) )
659 { _M_h.swap(__x._M_h); }
661#ifdef __glibcxx_node_extract
662 template<
typename,
typename,
typename>
663 friend class std::_Hash_merge_helper;
665 template<
typename _H2,
typename _P2>
669 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
673 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
674 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
677 template<
typename _H2,
typename _P2>
679 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
681 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
682 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
685 template<
typename _H2,
typename _P2>
687 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source)
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_multiset<_Value, _H2, _P2, _Alloc>&& __source)
705 {
return _M_h.hash_function(); }
711 {
return _M_h.key_eq(); }
729 {
return _M_h.find(__x); }
731#if __cplusplus > 201703L
732 template<
typename _Kt>
735 ->
decltype(_M_h._M_find_tr(__k))
736 {
return _M_h._M_find_tr(__k); }
741 {
return _M_h.find(__x); }
743#if __cplusplus > 201703L
744 template<
typename _Kt>
747 ->
decltype(_M_h._M_find_tr(__k))
748 {
return _M_h._M_find_tr(__k); }
764 {
return _M_h.count(__x); }
766#if __cplusplus > 201703L
767 template<
typename _Kt>
770 ->
decltype(_M_h._M_count_tr(__k))
771 {
return _M_h._M_count_tr(__k); }
775#if __cplusplus > 201703L
784 {
return _M_h.find(__x) != _M_h.end(); }
786 template<
typename _Kt>
789 ->
decltype(_M_h._M_find_tr(__k),
void(),
true)
790 {
return _M_h._M_find_tr(__k) != _M_h.end(); }
805 {
return _M_h.equal_range(__x); }
807#if __cplusplus > 201703L
808 template<
typename _Kt>
811 ->
decltype(_M_h._M_equal_range_tr(__k))
812 {
return _M_h._M_equal_range_tr(__k); }
817 {
return _M_h.equal_range(__x); }
819#if __cplusplus > 201703L
820 template<
typename _Kt>
823 ->
decltype(_M_h._M_equal_range_tr(__k))
824 {
return _M_h._M_equal_range_tr(__k); }
833 {
return _M_h.bucket_count(); }
838 {
return _M_h.max_bucket_count(); }
847 {
return _M_h.bucket_size(__n); }
856 {
return _M_h.bucket(__key); }
867 {
return _M_h.begin(__n); }
871 {
return _M_h.begin(__n); }
875 {
return _M_h.cbegin(__n); }
887 {
return _M_h.end(__n); }
891 {
return _M_h.end(__n); }
895 {
return _M_h.cend(__n); }
903 {
return _M_h.load_factor(); }
909 {
return _M_h.max_load_factor(); }
917 { _M_h.max_load_factor(__z); }
928 { _M_h.rehash(__n); }
939 { _M_h.reserve(__n); }
941 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
948#if __cpp_deduction_guides >= 201606
950 template<
typename _InputIterator,
952 hash<typename iterator_traits<_InputIterator>::value_type>,
954 equal_to<typename iterator_traits<_InputIterator>::value_type>,
955 typename _Allocator =
956 allocator<typename iterator_traits<_InputIterator>::value_type>,
957 typename = _RequireInputIter<_InputIterator>,
958 typename = _RequireNotAllocatorOrIntegral<_Hash>,
959 typename = _RequireNotAllocator<_Pred>,
960 typename = _RequireAllocator<_Allocator>>
961 unordered_set(_InputIterator, _InputIterator,
962 unordered_set<int>::size_type = {},
963 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
965 _Hash, _Pred, _Allocator>;
967 template<
typename _Tp,
typename _Hash = hash<_Tp>,
968 typename _Pred = equal_to<_Tp>,
969 typename _Allocator = allocator<_Tp>,
970 typename = _RequireNotAllocatorOrIntegral<_Hash>,
971 typename = _RequireNotAllocator<_Pred>,
972 typename = _RequireAllocator<_Allocator>>
975 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
978 template<
typename _InputIterator,
typename _Allocator,
979 typename = _RequireInputIter<_InputIterator>,
980 typename = _RequireAllocator<_Allocator>>
990 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
991 typename = _RequireInputIter<_InputIterator>,
992 typename = _RequireNotAllocatorOrIntegral<_Hash>,
993 typename = _RequireAllocator<_Allocator>>
1003 template<
typename _Tp,
typename _Allocator,
1004 typename = _RequireAllocator<_Allocator>>
1009 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1010 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1011 typename = _RequireAllocator<_Allocator>>
1016#if __glibcxx_containers_ranges
1017 template<ranges::input_range _Rg,
1022 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1023 ->
unordered_set<ranges::range_value_t<_Rg>, _Hash, _Pred, _Allocator>;
1025 template<ranges::input_range _Rg,
1026 __allocator_like _Allocator>
1034 template<ranges::input_range _Rg,
1035 __allocator_like _Allocator>
1042 template<ranges::input_range _Rg,
1043 __not_allocator_like _Hash,
1044 __allocator_like _Allocator>
1074 template<
typename _Value,
1080 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
1108#ifdef __glibcxx_node_extract
1109 using node_type =
typename _Hashtable::node_type;
1129 : _M_h(__n, __hf, __eql, __a)
1145 template<
typename _InputIterator>
1151 : _M_h(__first, __last, __n, __hf, __eql, __a)
1176 : _M_h(__l, __n, __hf, __eql, __a)
1202 const allocator_type& __a)
1203 : _M_h(__umset._M_h, __a)
1212 const allocator_type& __a)
1213 noexcept(
noexcept(_Hashtable(
std::move(__umset._M_h), __a)) )
1214 : _M_h(
std::
move(__umset._M_h), __a)
1226 template<
typename _InputIterator>
1233 template<
typename _InputIterator>
1252#if __glibcxx_containers_ranges
1266 template<__detail::__container_compatible_range<_Value> _Rg>
1272 : _M_h(__n, __hf, __eql, __a)
1278 template<__detail::__container_compatible_range<_Value> _Rg>
1283 template<__detail::__container_compatible_range<_Value> _Rg>
1289 template<__detail::__container_compatible_range<_Value> _Rg>
1318 {
return _M_h.get_allocator(); }
1323 _GLIBCXX_NODISCARD
bool
1325 {
return _M_h.empty(); }
1330 {
return _M_h.size(); }
1335 {
return _M_h.max_size(); }
1346 {
return _M_h.begin(); }
1350 {
return _M_h.begin(); }
1360 {
return _M_h.end(); }
1364 {
return _M_h.end(); }
1373 {
return _M_h.begin(); }
1381 {
return _M_h.end(); }
1392 template<
typename... _Args>
1414 template<
typename... _Args>
1429 {
return _M_h.insert(__x); }
1455 {
return _M_h.insert(__hint, __x); }
1459 {
return _M_h.insert(__hint,
std::move(__x)); }
1470 template<
typename _InputIterator>
1472 insert(_InputIterator __first, _InputIterator __last)
1473 { _M_h.insert(__first, __last); }
1484 { _M_h.insert(__l); }
1486#if __glibcxx_containers_ranges
1493 template<__detail::__container_compatible_range<_Value> _Rg>
1495 insert_range(_Rg&& __rg)
1497 auto __first = ranges::begin(__rg);
1498 const auto __last = ranges::end(__rg);
1499 if (__first == __last)
1502 if constexpr (ranges::forward_range<_Rg> || ranges::sized_range<_Rg>)
1503 _M_h._M_rehash_insert(
size_type(ranges::distance(__rg)));
1505 _M_h._M_rehash_insert(1);
1507 for (; __first != __last; ++__first)
1508 _M_h.emplace(*__first);
1512#ifdef __glibcxx_node_extract
1515 extract(const_iterator __pos)
1517 __glibcxx_assert(__pos !=
end());
1518 return _M_h.extract(__pos);
1524 {
return _M_h.extract(__key); }
1529 {
return _M_h._M_reinsert_node_multi(
cend(),
std::move(__nh)); }
1534 {
return _M_h._M_reinsert_node_multi(__hint,
std::move(__nh)); }
1554 {
return _M_h.erase(__position); }
1559 {
return _M_h.erase(__position); }
1577 {
return _M_h.erase(__x); }
1597 {
return _M_h.erase(__first, __last); }
1621 noexcept(
noexcept(_M_h.swap(__x._M_h)) )
1622 { _M_h.swap(__x._M_h); }
1624#ifdef __glibcxx_node_extract
1625 template<
typename,
typename,
typename>
1626 friend class std::_Hash_merge_helper;
1628 template<
typename _H2,
typename _P2>
1632 if constexpr (is_same_v<_H2, _Hash> && is_same_v<_P2, _Pred>)
1637 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1638 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1641 template<
typename _H2,
typename _P2>
1643 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
1646 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1647 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1650 template<
typename _H2,
typename _P2>
1652 merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source)
1655 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1656 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1659 template<
typename _H2,
typename _P2>
1661 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
1662 { merge(__source); }
1671 {
return _M_h.hash_function(); }
1677 {
return _M_h.key_eq(); }
1695 {
return _M_h.find(__x); }
1697#if __cplusplus > 201703L
1698 template<
typename _Kt>
1701 ->
decltype(_M_h._M_find_tr(__x))
1702 {
return _M_h._M_find_tr(__x); }
1707 {
return _M_h.find(__x); }
1709#if __cplusplus > 201703L
1710 template<
typename _Kt>
1713 ->
decltype(_M_h._M_find_tr(__x))
1714 {
return _M_h._M_find_tr(__x); }
1726 {
return _M_h.count(__x); }
1728#if __cplusplus > 201703L
1729 template<
typename _Kt>
1731 count(
const _Kt& __x)
const ->
decltype(_M_h._M_count_tr(__x))
1732 {
return _M_h._M_count_tr(__x); }
1736#if __cplusplus > 201703L
1745 {
return _M_h.find(__x) != _M_h.end(); }
1747 template<
typename _Kt>
1750 ->
decltype(_M_h._M_find_tr(__x),
void(),
true)
1751 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
1764 {
return _M_h.equal_range(__x); }
1766#if __cplusplus > 201703L
1767 template<
typename _Kt>
1770 ->
decltype(_M_h._M_equal_range_tr(__x))
1771 {
return _M_h._M_equal_range_tr(__x); }
1776 {
return _M_h.equal_range(__x); }
1778#if __cplusplus > 201703L
1779 template<
typename _Kt>
1782 ->
decltype(_M_h._M_equal_range_tr(__x))
1783 {
return _M_h._M_equal_range_tr(__x); }
1792 {
return _M_h.bucket_count(); }
1797 {
return _M_h.max_bucket_count(); }
1806 {
return _M_h.bucket_size(__n); }
1814 bucket(
const key_type& __key)
const
1815 {
return _M_h.bucket(__key); }
1826 {
return _M_h.begin(__n); }
1830 {
return _M_h.begin(__n); }
1834 {
return _M_h.cbegin(__n); }
1846 {
return _M_h.end(__n); }
1850 {
return _M_h.end(__n); }
1854 {
return _M_h.cend(__n); }
1862 {
return _M_h.load_factor(); }
1868 {
return _M_h.max_load_factor(); }
1876 { _M_h.max_load_factor(__z); }
1887 { _M_h.rehash(__n); }
1898 { _M_h.reserve(__n); }
1900 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1908#if __cpp_deduction_guides >= 201606
1910 template<
typename _InputIterator,
1912 hash<typename iterator_traits<_InputIterator>::value_type>,
1914 equal_to<typename iterator_traits<_InputIterator>::value_type>,
1915 typename _Allocator =
1916 allocator<typename iterator_traits<_InputIterator>::value_type>,
1917 typename = _RequireInputIter<_InputIterator>,
1918 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1919 typename = _RequireNotAllocator<_Pred>,
1920 typename = _RequireAllocator<_Allocator>>
1921 unordered_multiset(_InputIterator, _InputIterator,
1922 unordered_multiset<int>::size_type = {},
1923 _Hash = _Hash(), _Pred = _Pred(),
1924 _Allocator = _Allocator())
1926 _Hash, _Pred, _Allocator>;
1928 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1929 typename _Pred = equal_to<_Tp>,
1930 typename _Allocator = allocator<_Tp>,
1931 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1932 typename = _RequireNotAllocator<_Pred>,
1933 typename = _RequireAllocator<_Allocator>>
1936 _Hash = _Hash(), _Pred = _Pred(),
1937 _Allocator = _Allocator())
1940 template<
typename _InputIterator,
typename _Allocator,
1941 typename = _RequireInputIter<_InputIterator>,
1942 typename = _RequireAllocator<_Allocator>>
1952 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1953 typename = _RequireInputIter<_InputIterator>,
1954 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1955 typename = _RequireAllocator<_Allocator>>
1967 template<
typename _Tp,
typename _Allocator,
1968 typename = _RequireAllocator<_Allocator>>
1973 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1974 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1975 typename = _RequireAllocator<_Allocator>>
1980#if __glibcxx_containers_ranges
1981 template<ranges::input_range _Rg,
1987 _Hash = _Hash(), _Pred = _Pred(),
1988 _Allocator = _Allocator())
1991 template<ranges::input_range _Rg,
1992 __allocator_like _Allocator>
1999 template<ranges::input_range _Rg,
2000 __allocator_like _Allocator>
2008 template<ranges::input_range _Rg,
2009 __not_allocator_like _Hash,
2010 __allocator_like _Allocator>
2020 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2024 noexcept(
noexcept(__x.swap(__y)))
2027 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2031 noexcept(
noexcept(__x.swap(__y)))
2034 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2038 {
return __x._M_h._M_equal(__y._M_h); }
2040#if __cpp_impl_three_way_comparison < 201907L
2041 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2045 {
return !(__x == __y); }
2048 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2052 {
return __x._M_h._M_equal(__y._M_h); }
2054#if __cpp_impl_three_way_comparison < 201907L
2055 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2059 {
return !(__x == __y); }
2062_GLIBCXX_END_NAMESPACE_CONTAINER
2064#ifdef __glibcxx_node_extract
2066 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2067 typename _Hash2,
typename _Eq2>
2068 struct _Hash_merge_helper<
2069 _GLIBCXX_STD_C::
unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
2072 template<
typename... _Tp>
2073 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2074 template<
typename... _Tp>
2075 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2077 friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>;
2080 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2081 {
return __set._M_h; }
2084 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2085 {
return __set._M_h; }
2089 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
2090 typename _Hash2,
typename _Eq2>
2091 struct _Hash_merge_helper<
2096 template<
typename... _Tp>
2097 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
2098 template<
typename... _Tp>
2099 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
2101 friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>;
2104 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
2105 {
return __set._M_h; }
2108 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
2109 {
return __set._M_h; }
2113_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.