30 #ifndef _UNORDERED_SET_H
31 #define _UNORDERED_SET_H
33 namespace std _GLIBCXX_VISIBILITY(default)
35 _GLIBCXX_BEGIN_NAMESPACE_VERSION
36 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
42 template<
typename _Value,
47 using __uset_hashtable = _Hashtable<_Value, _Value, _Alloc,
48 __detail::_Identity, _Pred, _Hash,
49 __detail::_Mod_range_hashing,
50 __detail::_Default_ranged_hash,
51 __detail::_Prime_rehash_policy, _Tr>;
57 template<
typename _Value,
62 using __umset_hashtable = _Hashtable<_Value, _Value, _Alloc,
65 __detail::_Mod_range_hashing,
66 __detail::_Default_ranged_hash,
67 __detail::_Prime_rehash_policy, _Tr>;
69 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
93 template<
typename _Value,
99 typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
108 typedef typename _Hashtable::hasher
hasher;
127 #if __cplusplus > 201402L
128 using node_type =
typename _Hashtable::node_type;
129 using insert_return_type =
typename _Hashtable::insert_return_type;
149 : _M_h(__n, __hf, __eql, __a)
165 template<
typename _InputIterator>
171 : _M_h(__first, __last, __n, __hf, __eql, __a)
196 : _M_h(__uset._M_h, __a)
206 noexcept( noexcept(_Hashtable(
std::move(__uset._M_h), __a)) )
207 : _M_h(
std::
move(__uset._M_h), __a)
226 : _M_h(__l, __n, __hf, __eql, __a)
238 template<
typename _InputIterator>
245 template<
typename _InputIterator>
293 {
return _M_h.get_allocator(); }
298 _GLIBCXX_NODISCARD
bool
300 {
return _M_h.empty(); }
305 {
return _M_h.size(); }
310 {
return _M_h.max_size(); }
321 {
return _M_h.begin(); }
325 {
return _M_h.begin(); }
335 {
return _M_h.end(); }
339 {
return _M_h.end(); }
348 {
return _M_h.begin(); }
356 {
return _M_h.end(); }
375 template<
typename... _Args>
378 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
401 template<
typename... _Args>
404 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
422 {
return _M_h.insert(__x); }
451 {
return _M_h.insert(__hint, __x); }
455 {
return _M_h.insert(__hint,
std::move(__x)); }
467 template<
typename _InputIterator>
469 insert(_InputIterator __first, _InputIterator __last)
470 { _M_h.insert(__first, __last); }
481 { _M_h.insert(__l); }
483 #if __cplusplus > 201402L
488 __glibcxx_assert(__pos !=
end());
489 return _M_h.extract(__pos);
495 {
return _M_h.extract(__key); }
500 {
return _M_h._M_reinsert_node(
std::move(__nh)); }
505 {
return _M_h._M_reinsert_node(
std::move(__nh)).position; }
524 {
return _M_h.erase(__position); }
529 {
return _M_h.erase(__position); }
546 {
return _M_h.erase(__x); }
564 {
return _M_h.erase(__first, __last); }
587 noexcept( noexcept(_M_h.swap(__x._M_h)) )
588 { _M_h.swap(__x._M_h); }
590 #if __cplusplus > 201402L
591 template<
typename,
typename,
typename>
592 friend class std::_Hash_merge_helper;
594 template<
typename _H2,
typename _P2>
598 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
599 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
602 template<
typename _H2,
typename _P2>
604 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
607 template<
typename _H2,
typename _P2>
609 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source)
611 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
612 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
615 template<
typename _H2,
typename _P2>
617 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
627 {
return _M_h.hash_function(); }
633 {
return _M_h.key_eq(); }
651 {
return _M_h.find(__x); }
653 #if __cplusplus > 201703L
654 template<
typename _Kt>
657 -> decltype(_M_h._M_find_tr(__k))
658 {
return _M_h._M_find_tr(__k); }
663 {
return _M_h.find(__x); }
665 #if __cplusplus > 201703L
666 template<
typename _Kt>
669 -> decltype(_M_h._M_find_tr(__k))
670 {
return _M_h._M_find_tr(__k); }
686 {
return _M_h.count(__x); }
688 #if __cplusplus > 201703L
689 template<
typename _Kt>
692 -> decltype(_M_h._M_count_tr(__k))
693 {
return _M_h._M_count_tr(__k); }
697 #if __cplusplus > 201703L
706 {
return _M_h.find(__x) != _M_h.end(); }
708 template<
typename _Kt>
711 -> decltype(_M_h._M_find_tr(__k),
void(),
true)
712 {
return _M_h._M_find_tr(__k) != _M_h.end(); }
727 {
return _M_h.equal_range(__x); }
729 #if __cplusplus > 201703L
730 template<
typename _Kt>
733 -> decltype(_M_h._M_equal_range_tr(__k))
734 {
return _M_h._M_equal_range_tr(__k); }
739 {
return _M_h.equal_range(__x); }
741 #if __cplusplus > 201703L
742 template<
typename _Kt>
745 -> decltype(_M_h._M_equal_range_tr(__k))
746 {
return _M_h._M_equal_range_tr(__k); }
755 {
return _M_h.bucket_count(); }
760 {
return _M_h.max_bucket_count(); }
769 {
return _M_h.bucket_size(__n); }
778 {
return _M_h.bucket(__key); }
789 {
return _M_h.begin(__n); }
793 {
return _M_h.begin(__n); }
797 {
return _M_h.cbegin(__n); }
809 {
return _M_h.end(__n); }
813 {
return _M_h.end(__n); }
817 {
return _M_h.cend(__n); }
825 {
return _M_h.load_factor(); }
831 {
return _M_h.max_load_factor(); }
839 { _M_h.max_load_factor(__z); }
850 { _M_h.rehash(__n); }
861 { _M_h.reserve(__n); }
863 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
870 #if __cpp_deduction_guides >= 201606
872 template<
typename _InputIterator,
874 hash<typename iterator_traits<_InputIterator>::value_type>,
876 equal_to<typename iterator_traits<_InputIterator>::value_type>,
877 typename _Allocator =
878 allocator<typename iterator_traits<_InputIterator>::value_type>,
879 typename = _RequireInputIter<_InputIterator>,
880 typename = _RequireNotAllocatorOrIntegral<_Hash>,
881 typename = _RequireNotAllocator<_Pred>,
882 typename = _RequireAllocator<_Allocator>>
883 unordered_set(_InputIterator, _InputIterator,
885 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
886 -> unordered_set<
typename iterator_traits<_InputIterator>::value_type,
887 _Hash, _Pred, _Allocator>;
889 template<
typename _Tp,
typename _Hash = hash<_Tp>,
890 typename _Pred = equal_to<_Tp>,
891 typename _Allocator = allocator<_Tp>,
892 typename = _RequireNotAllocatorOrIntegral<_Hash>,
893 typename = _RequireNotAllocator<_Pred>,
894 typename = _RequireAllocator<_Allocator>>
895 unordered_set(initializer_list<_Tp>,
897 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
898 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
900 template<
typename _InputIterator,
typename _Allocator,
901 typename = _RequireInputIter<_InputIterator>,
902 typename = _RequireAllocator<_Allocator>>
903 unordered_set(_InputIterator, _InputIterator,
907 typename iterator_traits<_InputIterator>::value_type>,
909 typename iterator_traits<_InputIterator>::value_type>,
912 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
913 typename = _RequireInputIter<_InputIterator>,
914 typename = _RequireNotAllocatorOrIntegral<_Hash>,
915 typename = _RequireAllocator<_Allocator>>
916 unordered_set(_InputIterator, _InputIterator,
922 typename iterator_traits<_InputIterator>::value_type>,
925 template<
typename _Tp,
typename _Allocator,
926 typename = _RequireAllocator<_Allocator>>
927 unordered_set(initializer_list<_Tp>,
929 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
931 template<
typename _Tp,
typename _Hash,
typename _Allocator,
932 typename = _RequireNotAllocatorOrIntegral<_Hash>,
933 typename = _RequireAllocator<_Allocator>>
934 unordered_set(initializer_list<_Tp>,
936 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
959 template<
typename _Value,
960 typename _Hash = hash<_Value>,
961 typename _Pred = equal_to<_Value>,
962 typename _Alloc = allocator<_Value>>
965 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
974 typedef typename _Hashtable::hasher
hasher;
993 #if __cplusplus > 201402L
994 using node_type =
typename _Hashtable::node_type;
1014 : _M_h(__n, __hf, __eql, __a)
1030 template<
typename _InputIterator>
1036 : _M_h(__first, __last, __n, __hf, __eql, __a)
1061 : _M_h(__l, __n, __hf, __eql, __a)
1088 : _M_h(__umset._M_h, __a)
1098 noexcept( noexcept(_Hashtable(
std::move(__umset._M_h), __a)) )
1099 : _M_h(
std::
move(__umset._M_h), __a)
1111 template<
typename _InputIterator>
1118 template<
typename _InputIterator>
1158 {
return _M_h.get_allocator(); }
1163 _GLIBCXX_NODISCARD
bool
1165 {
return _M_h.empty(); }
1170 {
return _M_h.size(); }
1175 {
return _M_h.max_size(); }
1186 {
return _M_h.begin(); }
1190 {
return _M_h.begin(); }
1200 {
return _M_h.end(); }
1204 {
return _M_h.end(); }
1213 {
return _M_h.begin(); }
1221 {
return _M_h.end(); }
1232 template<
typename... _Args>
1235 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1254 template<
typename... _Args>
1257 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1269 {
return _M_h.insert(__x); }
1295 {
return _M_h.insert(__hint, __x); }
1299 {
return _M_h.insert(__hint,
std::move(__x)); }
1310 template<
typename _InputIterator>
1312 insert(_InputIterator __first, _InputIterator __last)
1313 { _M_h.insert(__first, __last); }
1324 { _M_h.insert(__l); }
1326 #if __cplusplus > 201402L
1331 __glibcxx_assert(__pos !=
end());
1332 return _M_h.extract(__pos);
1338 {
return _M_h.extract(__key); }
1343 {
return _M_h._M_reinsert_node_multi(
cend(),
std::move(__nh)); }
1348 {
return _M_h._M_reinsert_node_multi(__hint,
std::move(__nh)); }
1368 {
return _M_h.erase(__position); }
1373 {
return _M_h.erase(__position); }
1391 {
return _M_h.erase(__x); }
1411 {
return _M_h.erase(__first, __last); }
1435 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1436 { _M_h.swap(__x._M_h); }
1438 #if __cplusplus > 201402L
1439 template<
typename,
typename,
typename>
1440 friend class std::_Hash_merge_helper;
1442 template<
typename _H2,
typename _P2>
1447 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1448 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1451 template<
typename _H2,
typename _P2>
1453 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
1454 { merge(__source); }
1456 template<
typename _H2,
typename _P2>
1458 merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source)
1461 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1462 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1465 template<
typename _H2,
typename _P2>
1467 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
1468 { merge(__source); }
1477 {
return _M_h.hash_function(); }
1483 {
return _M_h.key_eq(); }
1501 {
return _M_h.find(__x); }
1503 #if __cplusplus > 201703L
1504 template<
typename _Kt>
1507 -> decltype(_M_h._M_find_tr(__x))
1508 {
return _M_h._M_find_tr(__x); }
1513 {
return _M_h.find(__x); }
1515 #if __cplusplus > 201703L
1516 template<
typename _Kt>
1519 -> decltype(_M_h._M_find_tr(__x))
1520 {
return _M_h._M_find_tr(__x); }
1532 {
return _M_h.count(__x); }
1534 #if __cplusplus > 201703L
1535 template<
typename _Kt>
1537 count(
const _Kt& __x)
const -> decltype(_M_h._M_count_tr(__x))
1538 {
return _M_h._M_count_tr(__x); }
1542 #if __cplusplus > 201703L
1551 {
return _M_h.find(__x) != _M_h.end(); }
1553 template<
typename _Kt>
1556 -> decltype(_M_h._M_find_tr(__x),
void(),
true)
1557 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
1570 {
return _M_h.equal_range(__x); }
1572 #if __cplusplus > 201703L
1573 template<
typename _Kt>
1576 -> decltype(_M_h._M_equal_range_tr(__x))
1577 {
return _M_h._M_equal_range_tr(__x); }
1582 {
return _M_h.equal_range(__x); }
1584 #if __cplusplus > 201703L
1585 template<
typename _Kt>
1588 -> decltype(_M_h._M_equal_range_tr(__x))
1589 {
return _M_h._M_equal_range_tr(__x); }
1598 {
return _M_h.bucket_count(); }
1603 {
return _M_h.max_bucket_count(); }
1612 {
return _M_h.bucket_size(__n); }
1620 bucket(
const key_type& __key)
const
1621 {
return _M_h.bucket(__key); }
1632 {
return _M_h.begin(__n); }
1636 {
return _M_h.begin(__n); }
1640 {
return _M_h.cbegin(__n); }
1652 {
return _M_h.end(__n); }
1656 {
return _M_h.end(__n); }
1660 {
return _M_h.cend(__n); }
1668 {
return _M_h.load_factor(); }
1674 {
return _M_h.max_load_factor(); }
1682 { _M_h.max_load_factor(__z); }
1693 { _M_h.rehash(__n); }
1704 { _M_h.reserve(__n); }
1706 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1714 #if __cpp_deduction_guides >= 201606
1716 template<
typename _InputIterator,
1718 hash<typename iterator_traits<_InputIterator>::value_type>,
1720 equal_to<typename iterator_traits<_InputIterator>::value_type>,
1721 typename _Allocator =
1722 allocator<typename iterator_traits<_InputIterator>::value_type>,
1723 typename = _RequireInputIter<_InputIterator>,
1724 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1725 typename = _RequireNotAllocator<_Pred>,
1726 typename = _RequireAllocator<_Allocator>>
1727 unordered_multiset(_InputIterator, _InputIterator,
1729 _Hash = _Hash(), _Pred = _Pred(),
1730 _Allocator = _Allocator())
1731 -> unordered_multiset<
typename iterator_traits<_InputIterator>::value_type,
1732 _Hash, _Pred, _Allocator>;
1734 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1735 typename _Pred = equal_to<_Tp>,
1736 typename _Allocator = allocator<_Tp>,
1737 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1738 typename = _RequireNotAllocator<_Pred>,
1739 typename = _RequireAllocator<_Allocator>>
1740 unordered_multiset(initializer_list<_Tp>,
1742 _Hash = _Hash(), _Pred = _Pred(),
1743 _Allocator = _Allocator())
1744 -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
1746 template<
typename _InputIterator,
typename _Allocator,
1747 typename = _RequireInputIter<_InputIterator>,
1748 typename = _RequireAllocator<_Allocator>>
1749 unordered_multiset(_InputIterator, _InputIterator,
1753 iterator_traits<_InputIterator>::value_type>,
1755 iterator_traits<_InputIterator>::value_type>,
1758 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1759 typename = _RequireInputIter<_InputIterator>,
1760 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1761 typename = _RequireAllocator<_Allocator>>
1762 unordered_multiset(_InputIterator, _InputIterator,
1765 -> unordered_multiset<
typename
1766 iterator_traits<_InputIterator>::value_type,
1770 iterator_traits<_InputIterator>::value_type>,
1773 template<
typename _Tp,
typename _Allocator,
1774 typename = _RequireAllocator<_Allocator>>
1775 unordered_multiset(initializer_list<_Tp>,
1777 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1779 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1780 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1781 typename = _RequireAllocator<_Allocator>>
1782 unordered_multiset(initializer_list<_Tp>,
1784 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
1788 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1790 swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1791 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1792 noexcept(noexcept(__x.swap(__y)))
1795 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1797 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1798 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1799 noexcept(noexcept(__x.swap(__y)))
1802 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1804 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1805 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1806 {
return __x._M_h._M_equal(__y._M_h); }
1808 #if __cpp_impl_three_way_comparison < 201907L
1809 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1811 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1812 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1813 {
return !(__x == __y); }
1816 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1818 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1819 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1820 {
return __x._M_h._M_equal(__y._M_h); }
1822 #if __cpp_impl_three_way_comparison < 201907L
1823 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1825 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1826 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1827 {
return !(__x == __y); }
1830 _GLIBCXX_END_NAMESPACE_CONTAINER
1832 #if __cplusplus > 201402L
1834 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1835 typename _Hash2,
typename _Eq2>
1836 struct _Hash_merge_helper<
1837 _GLIBCXX_STD_C::unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
1840 template<
typename... _Tp>
1841 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1842 template<
typename... _Tp>
1843 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
1845 friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>;
1848 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
1849 {
return __set._M_h; }
1852 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
1853 {
return __set._M_h; }
1857 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1858 typename _Hash2,
typename _Eq2>
1859 struct _Hash_merge_helper<
1860 _GLIBCXX_STD_C::unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>,
1864 template<
typename... _Tp>
1865 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1866 template<
typename... _Tp>
1867 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
1869 friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>;
1872 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
1873 {
return __set._M_h; }
1876 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
1877 {
return __set._M_h; }
1881 _GLIBCXX_END_NAMESPACE_VERSION
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
void swap(any &__x, any &__y) noexcept
Exchange the states of two any objects.
ISO C++ entities toplevel namespace is std.
__detail::_Hashtable_traits< _Cache, true, true > __uset_traits
Base types for unordered_set.
__detail::_Hashtable_traits< _Cache, true, false > __umset_traits
Base types for unordered_multiset.
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.
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
Iterator-related typedefs.
void insert(initializer_list< value_type > __l)
Inserts a list of elements into the unordered_multiset.
_Hashtable::pointer pointer
Iterator-related typedefs.
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.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
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
Iterator-related typedefs.
node_type extract(const key_type &__key)
Extract a node.
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
Iterator-related typedefs.
unordered_multiset(const allocator_type &__a)
Creates an unordered_multiset with no elements.
_Hashtable::allocator_type allocator_type
Public typedefs.
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
Public typedefs.
float load_factor() const noexcept
Returns the average number of elements per bucket.
unordered_multiset()=default
Default constructor.
iterator insert(const_iterator __hint, node_type &&__nh)
Re-insert an extracted node.
_Hashtable::size_type size_type
Iterator-related typedefs.
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
Public typedefs.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
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-related typedefs.
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.
key_equal key_eq() const
Returns the key comparison object with which the unordered_multiset was constructed.
unordered_multiset & operator=(const unordered_multiset &)=default
Copy assignment operator.
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
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-related typedefs.
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.
unordered_multiset & operator=(unordered_multiset &&)=default
Move assignment operator.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multiset.
iterator insert(node_type &&__nh)
Re-insert an extracted node.
_Hashtable::hasher hasher
Public typedefs.
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.
size_type size() const noexcept
Returns the size of the unordered_multiset.
_Hashtable::iterator iterator
Iterator-related typedefs.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
unordered_multiset & operator=(initializer_list< value_type > __l)
Unordered_multiset list assignment operator.
auto equal_range(const _Kt &__x) const -> decltype(_M_h._M_equal_range_tr(__x))
Finds a subsequence matching given key.
node_type extract(const_iterator __pos)
Extract a node.
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
Iterator-related typedefs.
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
Public typedefs.
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 ...
_Hashtable::iterator iterator
Iterator-related typedefs.
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
Iterator-related typedefs.
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
Public typedefs.
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
Public typedefs.
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.
unordered_set & operator=(const unordered_set &)=default
Copy assignment operator.
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.
unordered_set & operator=(initializer_list< value_type > __l)
Unordered_set list assignment operator.
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
Public typedefs.
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
insert_return_type insert(node_type &&__nh)
Re-insert an extracted node.
_Hashtable::size_type size_type
Iterator-related typedefs.
const_iterator cbegin() const noexcept
bool empty() const noexcept
Returns true if the unordered_set is empty.
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
Iterator-related typedefs.
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.
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
Public typedefs.
size_type size() const noexcept
Returns the size of the unordered_set.
iterator insert(const_iterator, node_type &&__nh)
Re-insert an extracted node.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
hasher hash_function() const
Returns the hash functor object with which the unordered_set was constructed.
unordered_set(const unordered_set &)=default
Copy constructor.
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
Public typedefs.
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert an element into the unordered_set.
const_iterator end() const noexcept
node_type extract(const key_type &__key)
Extract a node.
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
unordered_set()=default
Default constructor.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert an element into the unordered_set.
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.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the unordered_set.
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
Iterator-related typedefs.
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.
unordered_set & operator=(unordered_set &&)=default
Move assignment operator.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert an element into the unordered_set.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_set.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
void reserve(size_type __n)
Prepare the unordered_set for a specified number of elements.
node_type extract(const_iterator __pos)
Extract a node.
_Hashtable::pointer pointer
Iterator-related typedefs.
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.