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); }
497#if __glibcxx_associative_heterogeneous_insertion
498 template <__heterogeneous_hash_key<unordered_set> _Kt>
527 {
return _M_h.insert(__hint, __x); }
531 {
return _M_h.insert(__hint,
std::move(__x)); }
533#if __glibcxx_associative_heterogeneous_insertion
534 template <__heterogeneous_hash_key<unordered_set> _Kt>
536 insert(const_iterator, _Kt&& __x)
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
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
587 extract(const_iterator __pos)
589 __glibcxx_assert(__pos !=
end());
590 return _M_h.extract(__pos);
596 {
return _M_h.extract(__key); }
598#ifdef __glibcxx_associative_heterogeneous_erasure
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; }
632 {
return _M_h.erase(__position); }
637 {
return _M_h.erase(__position); }
654 {
return _M_h.erase(__x); }
656#ifdef __glibcxx_associative_heterogeneous_erasure
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
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)
749 {
return _M_h.hash_function(); }
755 {
return _M_h.key_eq(); }
773 {
return _M_h.find(__x); }
775#ifdef __glibcxx_generic_unordered_lookup
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
788 template<
typename _Kt>
790 find(
const _Kt& __x)
const
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
811 template<
typename _Kt>
813 count(
const _Kt& __x)
const
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
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
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
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,
1015 unordered_set<int>::size_type = {},
1016 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
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>>
1028 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1031 template<
typename _InputIterator,
typename _Allocator,
1032 typename = _RequireInputIter<_InputIterator>,
1033 typename = _RequireAllocator<_Allocator>>
1045 template<
typename _InputIterator,
typename _Allocator,
1046 typename = _RequireInputIter<_InputIterator>,
1047 typename = _RequireAllocator<_Allocator>>
1056 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1057 typename = _RequireInputIter<_InputIterator>,
1058 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1059 typename = _RequireAllocator<_Allocator>>
1069 template<
typename _Tp,
typename _Allocator,
1070 typename = _RequireAllocator<_Allocator>>
1077 template<
typename _Tp,
typename _Allocator,
1078 typename = _RequireAllocator<_Allocator>>
1082 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1083 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1084 typename = _RequireAllocator<_Allocator>>
1089#if __glibcxx_containers_ranges
1095 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
1096 ->
unordered_set<ranges::range_value_t<_Rg>, _Hash, _Pred, _Allocator>;
1099 __allocator_like _Allocator>
1108 __allocator_like _Allocator>
1116 __not_allocator_like _Hash,
1117 __allocator_like _Allocator>
1147 template<
typename _Value,
1153 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
1181#ifdef __glibcxx_node_extract
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)
1275 const allocator_type& __a)
1276 : _M_h(__umset._M_h, __a)
1285 const allocator_type& __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
1354 template<__detail::__container_compatible_range<_Value> _Rg>
1360 : _M_h(__n, __hf, __eql, __a)
1366 template<__detail::__container_compatible_range<_Value> _Rg>
1371 template<__detail::__container_compatible_range<_Value> _Rg>
1377 template<__detail::__container_compatible_range<_Value> _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>
1502 template<
typename... _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
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)
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
1603 extract(const_iterator __pos)
1605 __glibcxx_assert(__pos !=
end());
1606 return _M_h.extract(__pos);
1612 {
return _M_h.extract(__key); }
1614#ifdef __glibcxx_associative_heterogeneous_erasure
1615 template <__heterogeneous_hash_key<unordered_multiset> _Kt>
1617 extract(_Kt&& __key)
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)); }
1649 {
return _M_h.erase(__position); }
1654 {
return _M_h.erase(__position); }
1672 {
return _M_h.erase(__x); }
1674#ifdef __glibcxx_associative_heterogeneous_erasure
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
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); }
1773 {
return _M_h.hash_function(); }
1779 {
return _M_h.key_eq(); }
1797 {
return _M_h.find(__x); }
1799#ifdef __glibcxx_generic_unordered_lookup
1800 template<
typename _Kt>
1802 find(
const _Kt& __x)
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
1812 template<
typename _Kt>
1814 find(
const _Kt& __x)
const
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
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
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
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
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,
2033 unordered_multiset<int>::size_type = {},
2034 _Hash = _Hash(), _Pred = _Pred(),
2035 _Allocator = _Allocator())
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>>
2047 _Hash = _Hash(), _Pred = _Pred(),
2048 _Allocator = _Allocator())
2051 template<
typename _InputIterator,
typename _Allocator,
2052 typename = _RequireInputIter<_InputIterator>,
2053 typename = _RequireAllocator<_Allocator>>
2065 template<
typename _InputIterator,
typename _Allocator,
2066 typename = _RequireInputIter<_InputIterator>,
2067 typename = _RequireAllocator<_Allocator>>
2076 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
2077 typename = _RequireInputIter<_InputIterator>,
2078 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2079 typename = _RequireAllocator<_Allocator>>
2091 template<
typename _Tp,
typename _Allocator,
2092 typename = _RequireAllocator<_Allocator>>
2099 template<
typename _Tp,
typename _Allocator,
2100 typename = _RequireAllocator<_Allocator>>
2104 template<
typename _Tp,
typename _Hash,
typename _Allocator,
2105 typename = _RequireNotAllocatorOrIntegral<_Hash>,
2106 typename = _RequireAllocator<_Allocator>>
2111#if __glibcxx_containers_ranges
2118 _Hash = _Hash(), _Pred = _Pred(),
2119 _Allocator = _Allocator())
2123 __allocator_like _Allocator>
2131 __allocator_like _Allocator>
2140 __not_allocator_like _Hash,
2141 __allocator_like _Allocator>
2151 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2155 noexcept(
noexcept(__x.swap(__y)))
2158 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
2162 noexcept(
noexcept(__x.swap(__y)))
2165 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
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>
2176 {
return !(__x == __y); }
2179 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
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>
2190 {
return !(__x == __y); }
2193_GLIBCXX_END_NAMESPACE_CONTAINER
2195#ifdef __glibcxx_node_extract
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<
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; }
2244_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].
Traits class for iterators.
One of the comparison functors.
Struct holding two objects of arbitrary type.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
iterator begin() noexcept
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
_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.
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.
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
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.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
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.
_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.
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.
_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.
auto contains(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x), void(), true)
Finds whether an element with the given key exists.
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.
[range.sized] The sized_range concept.
A range for which ranges::begin returns an input iterator.
A range for which ranges::begin returns a forward iterator.