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>
95 template<
typename _Value,
101 typedef __uset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
110 typedef typename _Hashtable::hasher
hasher;
129 #if __cplusplus > 201402L 130 using node_type =
typename _Hashtable::node_type;
131 using insert_return_type =
typename _Hashtable::insert_return_type;
148 const hasher& __hf =
hasher(),
151 : _M_h(__n, __hf, __eql, __a)
167 template<
typename _InputIterator>
170 const hasher& __hf =
hasher(),
173 : _M_h(__first, __last, __n, __hf, __eql, __a)
197 const allocator_type& __a)
198 : _M_h(__uset._M_h, __a)
207 const allocator_type& __a)
208 noexcept( noexcept(_Hashtable(
std::move(__uset._M_h), __a)) )
225 const hasher& __hf =
hasher(),
228 : _M_h(__l, __n, __hf, __eql, __a)
236 const allocator_type& __a)
240 template<
typename _InputIterator>
243 const allocator_type& __a)
247 template<
typename _InputIterator>
249 size_type __n,
const hasher& __hf,
250 const allocator_type& __a)
256 const allocator_type& __a)
261 size_type __n,
const hasher& __hf,
262 const allocator_type& __a)
295 {
return _M_h.get_allocator(); }
300 _GLIBCXX_NODISCARD
bool 302 {
return _M_h.empty(); }
307 {
return _M_h.size(); }
312 {
return _M_h.max_size(); }
323 {
return _M_h.begin(); }
327 {
return _M_h.begin(); }
337 {
return _M_h.end(); }
341 {
return _M_h.end(); }
350 {
return _M_h.begin(); }
358 {
return _M_h.end(); }
377 template<
typename... _Args>
380 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
403 template<
typename... _Args>
406 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
424 {
return _M_h.insert(__x); }
452 insert(const_iterator __hint,
const value_type& __x)
453 {
return _M_h.insert(__hint, __x); }
456 insert(const_iterator __hint, value_type&& __x)
457 {
return _M_h.insert(__hint,
std::move(__x)); }
469 template<
typename _InputIterator>
471 insert(_InputIterator __first, _InputIterator __last)
472 { _M_h.insert(__first, __last); }
483 { _M_h.insert(__l); }
485 #if __cplusplus > 201402L 490 __glibcxx_assert(__pos !=
end());
491 return _M_h.extract(__pos);
497 {
return _M_h.extract(__key); }
502 {
return _M_h._M_reinsert_node(
std::move(__nh)); }
507 {
return _M_h._M_reinsert_node(
std::move(__nh)).position; }
526 {
return _M_h.erase(__position); }
531 {
return _M_h.erase(__position); }
548 {
return _M_h.erase(__x); }
565 erase(const_iterator __first, const_iterator __last)
566 {
return _M_h.erase(__first, __last); }
589 noexcept( noexcept(_M_h.swap(__x._M_h)) )
590 { _M_h.swap(__x._M_h); }
592 #if __cplusplus > 201402L 593 template<
typename,
typename,
typename>
594 friend class std::_Hash_merge_helper;
596 template<
typename _H2,
typename _P2>
600 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
601 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
604 template<
typename _H2,
typename _P2>
609 template<
typename _H2,
typename _P2>
613 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
614 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
617 template<
typename _H2,
typename _P2>
629 {
return _M_h.hash_function(); }
635 {
return _M_h.key_eq(); }
653 {
return _M_h.find(__x); }
655 #if __cplusplus > 201703L 656 template<
typename _Kt>
659 -> decltype(_M_h._M_find_tr(__k))
660 {
return _M_h._M_find_tr(__k); }
664 find(
const key_type& __x)
const 665 {
return _M_h.find(__x); }
667 #if __cplusplus > 201703L 668 template<
typename _Kt>
671 -> decltype(_M_h._M_find_tr(__k))
672 {
return _M_h._M_find_tr(__k); }
688 {
return _M_h.count(__x); }
690 #if __cplusplus > 201703L 691 template<
typename _Kt>
694 -> decltype(_M_h._M_count_tr(__k))
695 {
return _M_h._M_count_tr(__k); }
699 #if __cplusplus > 201703L 708 {
return _M_h.find(__x) != _M_h.end(); }
710 template<
typename _Kt>
713 -> decltype(_M_h._M_find_tr(__k), void(),
true)
714 {
return _M_h._M_find_tr(__k) != _M_h.end(); }
729 {
return _M_h.equal_range(__x); }
731 #if __cplusplus > 201703L 732 template<
typename _Kt>
735 -> decltype(_M_h._M_equal_range_tr(__k))
736 {
return _M_h._M_equal_range_tr(__k); }
741 {
return _M_h.equal_range(__x); }
743 #if __cplusplus > 201703L 744 template<
typename _Kt>
747 -> decltype(_M_h._M_equal_range_tr(__k))
748 {
return _M_h._M_equal_range_tr(__k); }
757 {
return _M_h.bucket_count(); }
762 {
return _M_h.max_bucket_count(); }
770 bucket_size(size_type __n)
const 771 {
return _M_h.bucket_size(__n); }
779 bucket(
const key_type& __key)
const 780 {
return _M_h.bucket(__key); }
791 {
return _M_h.begin(__n); }
795 {
return _M_h.begin(__n); }
799 {
return _M_h.cbegin(__n); }
811 {
return _M_h.end(__n); }
815 {
return _M_h.end(__n); }
819 {
return _M_h.cend(__n); }
827 {
return _M_h.load_factor(); }
833 {
return _M_h.max_load_factor(); }
841 { _M_h.max_load_factor(__z); }
852 { _M_h.rehash(__n); }
863 { _M_h.reserve(__n); }
865 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
872 #if __cpp_deduction_guides >= 201606 874 template<
typename _InputIterator,
879 typename _Allocator =
881 typename = _RequireInputIter<_InputIterator>,
882 typename = _RequireNotAllocatorOrIntegral<_Hash>,
883 typename = _RequireNotAllocator<_Pred>,
884 typename = _RequireAllocator<_Allocator>>
887 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
889 _Hash, _Pred, _Allocator>;
891 template<
typename _Tp,
typename _Hash = hash<_Tp>,
892 typename _Pred = equal_to<_Tp>,
893 typename _Allocator = allocator<_Tp>,
894 typename = _RequireNotAllocatorOrIntegral<_Hash>,
895 typename = _RequireNotAllocator<_Pred>,
896 typename = _RequireAllocator<_Allocator>>
899 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
902 template<
typename _InputIterator,
typename _Allocator,
903 typename = _RequireInputIter<_InputIterator>,
904 typename = _RequireAllocator<_Allocator>>
911 typename iterator_traits<_InputIterator>::value_type>,
914 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
915 typename = _RequireInputIter<_InputIterator>,
916 typename = _RequireNotAllocatorOrIntegral<_Hash>,
917 typename = _RequireAllocator<_Allocator>>
924 typename iterator_traits<_InputIterator>::value_type>,
927 template<
typename _Tp,
typename _Allocator,
928 typename = _RequireAllocator<_Allocator>>
933 template<
typename _Tp,
typename _Hash,
typename _Allocator,
934 typename = _RequireNotAllocatorOrIntegral<_Hash>,
935 typename = _RequireAllocator<_Allocator>>
963 template<
typename _Value,
969 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
978 typedef typename _Hashtable::hasher
hasher;
997 #if __cplusplus > 201402L 998 using node_type =
typename _Hashtable::node_type;
1015 const hasher& __hf =
hasher(),
1018 : _M_h(__n, __hf, __eql, __a)
1034 template<
typename _InputIterator>
1037 const hasher& __hf =
hasher(),
1040 : _M_h(__first, __last, __n, __hf, __eql, __a)
1062 const hasher& __hf =
hasher(),
1065 : _M_h(__l, __n, __hf, __eql, __a)
1091 const allocator_type& __a)
1092 : _M_h(__umset._M_h, __a)
1101 const allocator_type& __a)
1102 noexcept( noexcept(_Hashtable(
std::move(__umset._M_h), __a)) )
1111 const allocator_type& __a)
1115 template<
typename _InputIterator>
1118 const allocator_type& __a)
1122 template<
typename _InputIterator>
1124 size_type __n,
const hasher& __hf,
1125 const allocator_type& __a)
1131 const allocator_type& __a)
1136 size_type __n,
const hasher& __hf,
1137 const allocator_type& __a)
1162 {
return _M_h.get_allocator(); }
1167 _GLIBCXX_NODISCARD
bool 1169 {
return _M_h.empty(); }
1174 {
return _M_h.size(); }
1179 {
return _M_h.max_size(); }
1190 {
return _M_h.begin(); }
1194 {
return _M_h.begin(); }
1204 {
return _M_h.end(); }
1208 {
return _M_h.end(); }
1217 {
return _M_h.begin(); }
1225 {
return _M_h.end(); }
1236 template<
typename... _Args>
1239 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1258 template<
typename... _Args>
1261 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1273 {
return _M_h.insert(__x); }
1298 insert(const_iterator __hint,
const value_type& __x)
1299 {
return _M_h.insert(__hint, __x); }
1302 insert(const_iterator __hint, value_type&& __x)
1303 {
return _M_h.insert(__hint,
std::move(__x)); }
1314 template<
typename _InputIterator>
1316 insert(_InputIterator __first, _InputIterator __last)
1317 { _M_h.insert(__first, __last); }
1328 { _M_h.insert(__l); }
1330 #if __cplusplus > 201402L 1335 __glibcxx_assert(__pos !=
end());
1336 return _M_h.extract(__pos);
1342 {
return _M_h.extract(__key); }
1347 {
return _M_h._M_reinsert_node_multi(
cend(),
std::move(__nh)); }
1351 insert(const_iterator __hint, node_type&& __nh)
1352 {
return _M_h._M_reinsert_node_multi(__hint,
std::move(__nh)); }
1372 {
return _M_h.erase(__position); }
1377 {
return _M_h.erase(__position); }
1395 {
return _M_h.erase(__x); }
1414 erase(const_iterator __first, const_iterator __last)
1415 {
return _M_h.erase(__first, __last); }
1439 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1440 { _M_h.swap(__x._M_h); }
1442 #if __cplusplus > 201402L 1443 template<
typename,
typename,
typename>
1444 friend class std::_Hash_merge_helper;
1446 template<
typename _H2,
typename _P2>
1451 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1452 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1455 template<
typename _H2,
typename _P2>
1458 { merge(__source); }
1460 template<
typename _H2,
typename _P2>
1465 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1466 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1469 template<
typename _H2,
typename _P2>
1472 { merge(__source); }
1481 {
return _M_h.hash_function(); }
1487 {
return _M_h.key_eq(); }
1505 {
return _M_h.find(__x); }
1507 #if __cplusplus > 201703L 1508 template<
typename _Kt>
1511 -> decltype(_M_h._M_find_tr(__x))
1512 {
return _M_h._M_find_tr(__x); }
1517 {
return _M_h.find(__x); }
1519 #if __cplusplus > 201703L 1520 template<
typename _Kt>
1523 -> decltype(_M_h._M_find_tr(__x))
1524 {
return _M_h._M_find_tr(__x); }
1536 {
return _M_h.count(__x); }
1538 #if __cplusplus > 201703L 1539 template<
typename _Kt>
1541 count(
const _Kt& __x)
const -> decltype(_M_h._M_count_tr(__x))
1542 {
return _M_h._M_count_tr(__x); }
1546 #if __cplusplus > 201703L 1555 {
return _M_h.find(__x) != _M_h.end(); }
1557 template<
typename _Kt>
1560 -> decltype(_M_h._M_find_tr(__x), void(),
true)
1561 {
return _M_h._M_find_tr(__x) != _M_h.end(); }
1574 {
return _M_h.equal_range(__x); }
1576 #if __cplusplus > 201703L 1577 template<
typename _Kt>
1580 -> decltype(_M_h._M_equal_range_tr(__x))
1581 {
return _M_h._M_equal_range_tr(__x); }
1586 {
return _M_h.equal_range(__x); }
1588 #if __cplusplus > 201703L 1589 template<
typename _Kt>
1592 -> decltype(_M_h._M_equal_range_tr(__x))
1593 {
return _M_h._M_equal_range_tr(__x); }
1602 {
return _M_h.bucket_count(); }
1607 {
return _M_h.max_bucket_count(); }
1615 bucket_size(size_type __n)
const 1616 {
return _M_h.bucket_size(__n); }
1624 bucket(
const key_type& __key)
const 1625 {
return _M_h.bucket(__key); }
1636 {
return _M_h.begin(__n); }
1638 const_local_iterator
1640 {
return _M_h.begin(__n); }
1642 const_local_iterator
1644 {
return _M_h.cbegin(__n); }
1656 {
return _M_h.end(__n); }
1658 const_local_iterator
1660 {
return _M_h.end(__n); }
1662 const_local_iterator
1664 {
return _M_h.cend(__n); }
1672 {
return _M_h.load_factor(); }
1678 {
return _M_h.max_load_factor(); }
1686 { _M_h.max_load_factor(__z); }
1697 { _M_h.rehash(__n); }
1708 { _M_h.reserve(__n); }
1710 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1718 #if __cpp_deduction_guides >= 201606 1720 template<
typename _InputIterator,
1725 typename _Allocator =
1727 typename = _RequireInputIter<_InputIterator>,
1728 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1729 typename = _RequireNotAllocator<_Pred>,
1730 typename = _RequireAllocator<_Allocator>>
1733 _Hash = _Hash(), _Pred = _Pred(),
1734 _Allocator = _Allocator())
1736 _Hash, _Pred, _Allocator>;
1738 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1739 typename _Pred = equal_to<_Tp>,
1740 typename _Allocator = allocator<_Tp>,
1741 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1742 typename = _RequireNotAllocator<_Pred>,
1743 typename = _RequireAllocator<_Allocator>>
1746 _Hash = _Hash(), _Pred = _Pred(),
1747 _Allocator = _Allocator())
1750 template<
typename _InputIterator,
typename _Allocator,
1751 typename = _RequireInputIter<_InputIterator>,
1752 typename = _RequireAllocator<_Allocator>>
1757 iterator_traits<_InputIterator>::value_type>,
1759 iterator_traits<_InputIterator>::value_type>,
1762 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1763 typename = _RequireInputIter<_InputIterator>,
1764 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1765 typename = _RequireAllocator<_Allocator>>
1770 iterator_traits<_InputIterator>::value_type,
1774 iterator_traits<_InputIterator>::value_type>,
1777 template<
typename _Tp,
typename _Allocator,
1778 typename = _RequireAllocator<_Allocator>>
1783 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1784 typename = _RequireNotAllocatorOrIntegral<_Hash>,
1785 typename = _RequireAllocator<_Allocator>>
1792 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1796 noexcept(noexcept(__x.
swap(__y)))
1799 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1803 noexcept(noexcept(__x.
swap(__y)))
1806 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1810 {
return __x._M_h._M_equal(__y._M_h); }
1812 #if __cpp_impl_three_way_comparison < 201907L 1813 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1817 {
return !(__x == __y); }
1820 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1824 {
return __x._M_h._M_equal(__y._M_h); }
1826 #if __cpp_impl_three_way_comparison < 201907L 1827 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1831 {
return !(__x == __y); }
1834 _GLIBCXX_END_NAMESPACE_CONTAINER
1836 #if __cplusplus > 201402L 1838 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1839 typename _Hash2,
typename _Eq2>
1840 struct _Hash_merge_helper<
1841 _GLIBCXX_STD_C::
unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
1844 template<
typename... _Tp>
1845 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1846 template<
typename... _Tp>
1853 {
return __set._M_h; }
1857 {
return __set._M_h; }
1861 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1862 typename _Hash2,
typename _Eq2>
1863 struct _Hash_merge_helper<
1868 template<
typename... _Tp>
1869 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1870 template<
typename... _Tp>
1877 {
return __set._M_h; }
1881 {
return __set._M_h; }
1885 _GLIBCXX_END_NAMESPACE_VERSION
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
iterator erase(iterator __position)
Erases an element from an unordered_set.
unordered_set(const allocator_type &__a)
Creates an unordered_set with no elements.
_Hashtable::reference reference
Iterator-related typedefs.
const_iterator end() const noexcept
hasher hash_function() const
Returns the hash functor object with which the unordered_multiset was constructed.
node_type extract(const_iterator __pos)
Extract a node.
key_equal key_eq() const
Returns the key comparison object with which the unordered_multiset was constructed.
const_iterator cbegin() const noexcept
auto count(const _Kt &__x) const -> decltype(_M_h._M_count_tr(__x))
Finds the number of elements.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
_Hashtable::pointer pointer
Iterator-related typedefs.
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...
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_set.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_set.
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
const_iterator begin() const noexcept
void reserve(size_type __n)
Prepare the unordered_multiset for a specified number of elements.
__detail::_Hashtable_traits< _Cache, true, false > __umset_traits
Base types for unordered_multiset.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
bool empty() const noexcept
Returns true if the unordered_set is empty.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert an element into the unordered_set.
unordered_multiset(const allocator_type &__a)
Creates an unordered_multiset with no elements.
iterator erase(const_iterator __position)
Erases an element from an unordered_set.
iterator insert(const_iterator, node_type &&__nh)
Re-insert an extracted node.
void swap(unordered_multiset &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another 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_set & operator=(initializer_list< value_type > __l)
Unordered_set list assignment operator.
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
_Hashtable::iterator iterator
Iterator-related typedefs.
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
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.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multiset.
iterator insert(const_iterator __hint, const value_type &__x)
Attempts to insert an element into the unordered_set.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_set.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
hasher hash_function() const
Returns the hash functor object with which the unordered_set was constructed.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
iterator erase(const_iterator __position)
Erases an element from an unordered_multiset.
_Hashtable::iterator iterator
Iterator-related typedefs.
const_iterator cend() const noexcept
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
auto equal_range(const _Kt &__k) const -> decltype(_M_h._M_equal_range_tr(__k))
Finds a subsequence matching given key.
node_type extract(const_iterator __pos)
Extract a node.
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert an element into the unordered_set.
void insert(initializer_list< value_type > __l)
Inserts a list of elements into the unordered_multiset.
void rehash(size_type __n)
May rehash the unordered_multiset.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
bool empty() const noexcept
Returns true if the unordered_multiset is empty.
_Hashtable::const_iterator const_iterator
Iterator-related 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.
unordered_multiset & operator=(initializer_list< value_type > __l)
Unordered_multiset list assignment operator.
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.
const_iterator end() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_set.
void max_load_factor(float __z)
Change the unordered_set maximum load factor.
size_type size() const noexcept
Returns the size of the unordered_multiset.
const_iterator cbegin() const noexcept
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert an element into the unordered_set.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_multiset.
unordered_set()=default
Default constructor.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_set.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
One of the comparison functors.
node_type extract(const key_type &__key)
Extract a node.
auto equal_range(const _Kt &__x) -> decltype(_M_h._M_equal_range_tr(__x))
Finds a subsequence matching given key.
insert_return_type insert(node_type &&__nh)
Re-insert an extracted node.
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_pointer const_pointer
Iterator-related typedefs.
iterator begin() noexcept
void rehash(size_type __n)
May rehash the unordered_set.
ISO C++ entities toplevel namespace is std.
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 begin() noexcept
float load_factor() const noexcept
Returns the average number of elements per bucket.
auto count(const _Kt &__k) const -> decltype(_M_h._M_count_tr(__k))
Finds the number of elements.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_multiset.
_Hashtable::value_type value_type
Public typedefs.
_Hashtable::value_type value_type
Public typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Inserts an element into the unordered_multiset.
iterator find(const key_type &__x)
Tries to locate an element in an unordered_set.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the unordered_set.
_Hashtable::key_type key_type
Public typedefs.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
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 &__x) const -> decltype(_M_h._M_equal_range_tr(__x))
Finds a subsequence matching given key.
auto find(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x))
Tries to locate an element in an unordered_multiset.
auto find(const _Kt &__x) -> decltype(_M_h._M_find_tr(__x))
Tries to locate an element in an unordered_multiset.
iterator erase(iterator __position)
Erases an element from an unordered_multiset.
key_equal key_eq() const
Returns the key comparison object with which the unordered_set was constructed.
iterator insert(const_iterator __hint, const value_type &__x)
Inserts an element into the unordered_multiset.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
size_type max_size() const noexcept
Returns the maximum size of the unordered_set.
float load_factor() const noexcept
Returns the average number of elements per bucket.
auto contains(const _Kt &__k) const -> decltype(_M_h._M_find_tr(__k), void(), true)
Finds whether an element with the given key exists.
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.
A standard container composed of unique keys (containing at most one of each key value) in which the ...
_Hashtable::difference_type difference_type
Iterator-related typedefs.
auto contains(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x), void(), true)
Finds whether an element with the given key exists.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_multiset.
__detail::_Hashtable_traits< _Cache, true, true > __uset_traits
Base types for unordered_set.
_Hashtable::allocator_type allocator_type
Public typedefs.
bool contains(const key_type &__x) const
Finds whether an element with the given key exists.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
void max_load_factor(float __z)
Change the unordered_multiset maximum load factor.
iterator insert(const_iterator __hint, value_type &&__x)
Inserts an element into the unordered_multiset.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
_Hashtable::key_equal key_equal
Public typedefs.
float max_load_factor() const noexcept
Returns a positive number that the unordered_multiset tries to keep the load factor less than or equa...
iterator insert(const value_type &__x)
Inserts an element into the unordered_multiset.
void insert(_InputIterator __first, _InputIterator __last)
A template function that inserts a range of elements.
size_type max_size() const noexcept
Returns the maximum size of the unordered_multiset.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
Struct holding two objects of arbitrary type.
The standard allocator, as per C++03 [20.4.1].
iterator find(const key_type &__x)
Tries to locate an element in an unordered_multiset.
_Hashtable::key_type key_type
Public typedefs.
_Hashtable::hasher hasher
Public typedefs.
void reserve(size_type __n)
Prepare the unordered_set for a specified number of elements.
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
const_iterator cend() const noexcept
bool contains(const key_type &__x) const
Finds whether an element with the given key exists.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
_Hashtable::allocator_type allocator_type
Public typedefs.
_Hashtable::size_type size_type
Iterator-related typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to insert an element into the unordered_set.
auto find(const _Kt &__k) const -> decltype(_M_h._M_find_tr(__k))
Tries to locate an element in an unordered_set.
iterator insert(const_iterator __hint, node_type &&__nh)
Re-insert an extracted node.
size_type count(const key_type &__x) const
Finds the number of elements.
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
Traits class for iterators.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
auto equal_range(const _Kt &__k) -> decltype(_M_h._M_equal_range_tr(__k))
Finds a subsequence matching given key.
size_type size() const noexcept
Returns the size of the unordered_set.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
unordered_set & operator=(const unordered_set &)=default
Copy assignment operator.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_set.
iterator emplace(_Args &&... __args)
Builds and insert an element into the unordered_multiset.
auto find(const _Kt &__k) -> decltype(_M_h._M_find_tr(__k))
Tries to locate an element in an unordered_set.
iterator insert(node_type &&__nh)
Re-insert an extracted node.
_Hashtable::key_equal key_equal
Public typedefs.
_Hashtable::size_type size_type
Iterator-related typedefs.
_Hashtable::reference reference
Iterator-related typedefs.
node_type extract(const key_type &__key)
Extract a node.
size_type count(const key_type &__x) const
Finds the number of elements.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multiset.
_Hashtable::pointer pointer
Iterator-related typedefs.
_Hashtable::hasher hasher
Public typedefs.
std::pair< iterator, iterator > equal_range(const key_type &__x)
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(value_type &&__x)
Inserts an element into the unordered_multiset.
Primary class template hash.
const_iterator begin() const noexcept