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,
48 __detail::_Identity, _Pred, _Hash,
57 template<
typename _Value,
69 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
93 template<
typename _Value,
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 : _M_h(
std::move(__uset._M_h), __a)
225 : _M_h(__l, __n, __hf, __eql, __a)
237 template<
typename _InputIterator>
244 template<
typename _InputIterator>
292 {
return _M_h.get_allocator(); }
297 _GLIBCXX_NODISCARD
bool 299 {
return _M_h.empty(); }
304 {
return _M_h.size(); }
309 {
return _M_h.max_size(); }
320 {
return _M_h.begin(); }
324 {
return _M_h.begin(); }
334 {
return _M_h.end(); }
338 {
return _M_h.end(); }
347 {
return _M_h.begin(); }
355 {
return _M_h.end(); }
374 template<
typename... _Args>
377 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
400 template<
typename... _Args>
403 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
421 {
return _M_h.insert(__x); }
425 {
return _M_h.insert(std::move(__x)); }
450 {
return _M_h.insert(__hint, __x); }
454 {
return _M_h.insert(__hint, std::move(__x)); }
466 template<
typename _InputIterator>
468 insert(_InputIterator __first, _InputIterator __last)
469 { _M_h.insert(__first, __last); }
480 { _M_h.insert(__l); }
482 #if __cplusplus > 201402L 487 __glibcxx_assert(__pos !=
end());
488 return _M_h.extract(__pos);
494 {
return _M_h.extract(__key); }
499 {
return _M_h._M_reinsert_node(std::move(__nh)); }
504 {
return _M_h._M_reinsert_node(std::move(__nh)).position; }
523 {
return _M_h.erase(__position); }
528 {
return _M_h.erase(__position); }
545 {
return _M_h.erase(__x); }
563 {
return _M_h.erase(__first, __last); }
586 noexcept( noexcept(_M_h.swap(__x._M_h)) )
587 { _M_h.swap(__x._M_h); }
589 #if __cplusplus > 201402L 590 template<
typename,
typename,
typename>
591 friend class std::_Hash_merge_helper;
593 template<
typename _H2,
typename _P2>
597 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
598 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
601 template<
typename _H2,
typename _P2>
603 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
606 template<
typename _H2,
typename _P2>
608 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>& __source)
610 using _Merge_helper = _Hash_merge_helper<unordered_set, _H2, _P2>;
611 _M_h._M_merge_unique(_Merge_helper::_S_get_table(__source));
614 template<
typename _H2,
typename _P2>
616 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
626 {
return _M_h.hash_function(); }
632 {
return _M_h.key_eq(); }
650 {
return _M_h.find(__x); }
654 {
return _M_h.find(__x); }
668 {
return _M_h.count(__x); }
670 #if __cplusplus > 201703L 678 {
return _M_h.find(__x) != _M_h.end(); }
692 {
return _M_h.equal_range(__x); }
696 {
return _M_h.equal_range(__x); }
704 {
return _M_h.bucket_count(); }
709 {
return _M_h.max_bucket_count(); }
718 {
return _M_h.bucket_size(__n); }
727 {
return _M_h.bucket(__key); }
738 {
return _M_h.begin(__n); }
742 {
return _M_h.begin(__n); }
746 {
return _M_h.cbegin(__n); }
758 {
return _M_h.end(__n); }
762 {
return _M_h.end(__n); }
766 {
return _M_h.cend(__n); }
774 {
return _M_h.load_factor(); }
780 {
return _M_h.max_load_factor(); }
788 { _M_h.max_load_factor(__z); }
799 { _M_h.rehash(__n); }
810 { _M_h.reserve(__n); }
812 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
819 #if __cpp_deduction_guides >= 201606 821 template<
typename _InputIterator,
823 hash<typename iterator_traits<_InputIterator>::value_type>,
825 equal_to<typename iterator_traits<_InputIterator>::value_type>,
826 typename _Allocator =
827 allocator<typename iterator_traits<_InputIterator>::value_type>,
828 typename = _RequireInputIter<_InputIterator>,
829 typename = _RequireAllocator<_Allocator>>
830 unordered_set(_InputIterator, _InputIterator,
832 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
833 -> unordered_set<
typename iterator_traits<_InputIterator>::value_type,
834 _Hash, _Pred, _Allocator>;
836 template<
typename _Tp,
typename _Hash = hash<_Tp>,
837 typename _Pred = equal_to<_Tp>,
838 typename _Allocator = allocator<_Tp>,
839 typename = _RequireAllocator<_Allocator>>
840 unordered_set(initializer_list<_Tp>,
842 _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator())
843 -> unordered_set<_Tp, _Hash, _Pred, _Allocator>;
845 template<
typename _InputIterator,
typename _Allocator,
846 typename = _RequireInputIter<_InputIterator>,
847 typename = _RequireAllocator<_Allocator>>
848 unordered_set(_InputIterator, _InputIterator,
852 typename iterator_traits<_InputIterator>::value_type>,
854 typename iterator_traits<_InputIterator>::value_type>,
857 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
858 typename = _RequireInputIter<_InputIterator>,
859 typename = _RequireAllocator<_Allocator>>
860 unordered_set(_InputIterator, _InputIterator,
866 typename iterator_traits<_InputIterator>::value_type>,
869 template<
typename _Tp,
typename _Allocator,
870 typename = _RequireAllocator<_Allocator>>
871 unordered_set(initializer_list<_Tp>,
873 -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
875 template<
typename _Tp,
typename _Hash,
typename _Allocator,
876 typename = _RequireAllocator<_Allocator>>
877 unordered_set(initializer_list<_Tp>,
879 -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
902 template<
typename _Value,
903 typename _Hash = hash<_Value>,
904 typename _Pred = equal_to<_Value>,
905 typename _Alloc = allocator<_Value>>
906 class unordered_multiset
908 typedef __umset_hashtable<_Value, _Hash, _Pred, _Alloc> _Hashtable;
917 typedef typename _Hashtable::hasher
hasher;
936 #if __cplusplus > 201402L 937 using node_type =
typename _Hashtable::node_type;
957 : _M_h(__n, __hf, __eql, __a)
973 template<
typename _InputIterator>
979 : _M_h(__first, __last, __n, __hf, __eql, __a)
1004 : _M_h(__l, __n, __hf, __eql, __a)
1031 : _M_h(__umset._M_h, __a)
1041 : _M_h(
std::move(__umset._M_h), __a)
1053 template<
typename _InputIterator>
1060 template<
typename _InputIterator>
1100 {
return _M_h.get_allocator(); }
1105 _GLIBCXX_NODISCARD
bool 1107 {
return _M_h.empty(); }
1112 {
return _M_h.size(); }
1117 {
return _M_h.max_size(); }
1128 {
return _M_h.begin(); }
1132 {
return _M_h.begin(); }
1142 {
return _M_h.end(); }
1146 {
return _M_h.end(); }
1155 {
return _M_h.begin(); }
1163 {
return _M_h.end(); }
1174 template<
typename... _Args>
1177 {
return _M_h.emplace(std::forward<_Args>(__args)...); }
1196 template<
typename... _Args>
1199 {
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
1211 {
return _M_h.insert(__x); }
1215 {
return _M_h.insert(std::move(__x)); }
1237 {
return _M_h.insert(__hint, __x); }
1241 {
return _M_h.insert(__hint, std::move(__x)); }
1252 template<
typename _InputIterator>
1254 insert(_InputIterator __first, _InputIterator __last)
1255 { _M_h.insert(__first, __last); }
1266 { _M_h.insert(__l); }
1268 #if __cplusplus > 201402L 1273 __glibcxx_assert(__pos !=
end());
1274 return _M_h.extract(__pos);
1280 {
return _M_h.extract(__key); }
1285 {
return _M_h._M_reinsert_node_multi(
cend(), std::move(__nh)); }
1290 {
return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); }
1310 {
return _M_h.erase(__position); }
1315 {
return _M_h.erase(__position); }
1333 {
return _M_h.erase(__x); }
1353 {
return _M_h.erase(__first, __last); }
1377 noexcept( noexcept(_M_h.swap(__x._M_h)) )
1378 { _M_h.swap(__x._M_h); }
1380 #if __cplusplus > 201402L 1381 template<
typename,
typename,
typename>
1382 friend class std::_Hash_merge_helper;
1384 template<
typename _H2,
typename _P2>
1389 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1390 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1393 template<
typename _H2,
typename _P2>
1395 merge(unordered_multiset<_Value, _H2, _P2, _Alloc>&& __source)
1396 { merge(__source); }
1398 template<
typename _H2,
typename _P2>
1400 merge(unordered_set<_Value, _H2, _P2, _Alloc>& __source)
1403 = _Hash_merge_helper<unordered_multiset, _H2, _P2>;
1404 _M_h._M_merge_multi(_Merge_helper::_S_get_table(__source));
1407 template<
typename _H2,
typename _P2>
1409 merge(unordered_set<_Value, _H2, _P2, _Alloc>&& __source)
1410 { merge(__source); }
1419 {
return _M_h.hash_function(); }
1425 {
return _M_h.key_eq(); }
1443 {
return _M_h.find(__x); }
1447 {
return _M_h.find(__x); }
1457 {
return _M_h.count(__x); }
1459 #if __cplusplus > 201703L 1466 contains(
const key_type& __x)
const 1467 {
return _M_h.find(__x) != _M_h.end(); }
1479 {
return _M_h.equal_range(__x); }
1483 {
return _M_h.equal_range(__x); }
1491 {
return _M_h.bucket_count(); }
1496 {
return _M_h.max_bucket_count(); }
1505 {
return _M_h.bucket_size(__n); }
1513 bucket(
const key_type& __key)
const 1514 {
return _M_h.bucket(__key); }
1525 {
return _M_h.begin(__n); }
1529 {
return _M_h.begin(__n); }
1533 {
return _M_h.cbegin(__n); }
1545 {
return _M_h.end(__n); }
1549 {
return _M_h.end(__n); }
1553 {
return _M_h.cend(__n); }
1561 {
return _M_h.load_factor(); }
1567 {
return _M_h.max_load_factor(); }
1575 { _M_h.max_load_factor(__z); }
1586 { _M_h.rehash(__n); }
1597 { _M_h.reserve(__n); }
1599 template<
typename _Value1,
typename _Hash1,
typename _Pred1,
1607 #if __cpp_deduction_guides >= 201606 1609 template<
typename _InputIterator,
1611 hash<typename iterator_traits<_InputIterator>::value_type>,
1613 equal_to<typename iterator_traits<_InputIterator>::value_type>,
1614 typename _Allocator =
1615 allocator<typename iterator_traits<_InputIterator>::value_type>,
1616 typename = _RequireInputIter<_InputIterator>,
1617 typename = _RequireAllocator<_Allocator>>
1618 unordered_multiset(_InputIterator, _InputIterator,
1620 _Hash = _Hash(), _Pred = _Pred(),
1621 _Allocator = _Allocator())
1622 -> unordered_multiset<
typename iterator_traits<_InputIterator>::value_type,
1623 _Hash, _Pred, _Allocator>;
1625 template<
typename _Tp,
typename _Hash = hash<_Tp>,
1626 typename _Pred = equal_to<_Tp>,
1627 typename _Allocator = allocator<_Tp>,
1628 typename = _RequireAllocator<_Allocator>>
1629 unordered_multiset(initializer_list<_Tp>,
1631 _Hash = _Hash(), _Pred = _Pred(),
1632 _Allocator = _Allocator())
1633 -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>;
1635 template<
typename _InputIterator,
typename _Allocator,
1636 typename = _RequireInputIter<_InputIterator>,
1637 typename = _RequireAllocator<_Allocator>>
1638 unordered_multiset(_InputIterator, _InputIterator,
1642 iterator_traits<_InputIterator>::value_type>,
1644 iterator_traits<_InputIterator>::value_type>,
1647 template<
typename _InputIterator,
typename _Hash,
typename _Allocator,
1648 typename = _RequireInputIter<_InputIterator>,
1649 typename = _RequireAllocator<_Allocator>>
1650 unordered_multiset(_InputIterator, _InputIterator,
1653 -> unordered_multiset<
typename 1654 iterator_traits<_InputIterator>::value_type,
1658 iterator_traits<_InputIterator>::value_type>,
1661 template<
typename _Tp,
typename _Allocator,
1662 typename = _RequireAllocator<_Allocator>>
1663 unordered_multiset(initializer_list<_Tp>,
1665 -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>;
1667 template<
typename _Tp,
typename _Hash,
typename _Allocator,
1668 typename = _RequireAllocator<_Allocator>>
1669 unordered_multiset(initializer_list<_Tp>,
1671 -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>;
1675 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1677 swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1678 unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1679 noexcept(noexcept(__x.swap(__y)))
1682 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1684 swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1685 unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1686 noexcept(noexcept(__x.swap(__y)))
1689 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1691 operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1692 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1693 {
return __x._M_h._M_equal(__y._M_h); }
1695 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1697 operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
1698 const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
1699 {
return !(__x == __y); }
1701 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1703 operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1704 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1705 {
return __x._M_h._M_equal(__y._M_h); }
1707 template<
class _Value,
class _Hash,
class _Pred,
class _Alloc>
1709 operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
1710 const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
1711 {
return !(__x == __y); }
1713 _GLIBCXX_END_NAMESPACE_CONTAINER
1715 #if __cplusplus > 201402L 1717 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1718 typename _Hash2,
typename _Eq2>
1719 struct _Hash_merge_helper<
1720 _GLIBCXX_STD_C::unordered_set<_Val, _Hash1, _Eq1, _Alloc>, _Hash2, _Eq2>
1723 template<
typename... _Tp>
1724 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1725 template<
typename... _Tp>
1726 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
1728 friend unordered_set<_Val, _Hash1, _Eq1, _Alloc>;
1731 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
1732 {
return __set._M_h; }
1735 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
1736 {
return __set._M_h; }
1740 template<
typename _Val,
typename _Hash1,
typename _Eq1,
typename _Alloc,
1741 typename _Hash2,
typename _Eq2>
1742 struct _Hash_merge_helper<
1743 _GLIBCXX_STD_C::unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>,
1747 template<
typename... _Tp>
1748 using unordered_set = _GLIBCXX_STD_C::unordered_set<_Tp...>;
1749 template<
typename... _Tp>
1750 using unordered_multiset = _GLIBCXX_STD_C::unordered_multiset<_Tp...>;
1752 friend unordered_multiset<_Val, _Hash1, _Eq1, _Alloc>;
1755 _S_get_table(unordered_set<_Val, _Hash2, _Eq2, _Alloc>& __set)
1756 {
return __set._M_h; }
1759 _S_get_table(unordered_multiset<_Val, _Hash2, _Eq2, _Alloc>& __set)
1760 {
return __set._M_h; }
1764 _GLIBCXX_END_NAMESPACE_VERSION
iterator find(const key_type &__x)
Tries to locate an element in an unordered_set.
size_type erase(const key_type &__x)
Erases elements according to the provided key.
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.
key_equal key_eq() const
Returns the key comparison object with which the unordered_multiset was constructed.
void rehash(size_type __n)
May rehash the unordered_multiset.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert an element into the unordered_set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that inserts a range of elements.
_Hashtable::value_type value_type
Public typedefs.
const_iterator cbegin() const noexcept
Default value for rehash policy. Bucket size is (usually) the smallest prime that keeps the load fact...
iterator erase(const_iterator __position)
Erases an element from an unordered_set.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
iterator insert(const_iterator __hint, const value_type &__x)
Attempts to insert an element into the unordered_set.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_multiset.
unordered_set & operator=(const unordered_set &)=default
Copy assignment operator.
const_iterator cend() const noexcept
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
The standard allocator, as per [20.4].
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_multiset.
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the unordered_set.
_Hashtable::iterator iterator
Iterator-related typedefs.
void rehash(size_type __n)
May rehash the unordered_set.
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements.
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
_Hashtable::allocator_type allocator_type
Public typedefs.
_Hashtable::key_equal key_equal
Public typedefs.
void reserve(size_type __n)
Prepare the unordered_set for a specified number of elements.
size_type size() const noexcept
Returns the size of the unordered_set.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
size_type max_bucket_count() const noexcept
Returns the maximum number of buckets of the unordered_set.
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.
const_iterator end() const noexcept
_Hashtable::reference reference
Iterator-related typedefs.
void swap(unordered_multiset &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_multiset.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
Primary class template hash.
_Hashtable::pointer pointer
Iterator-related typedefs.
iterator erase(iterator __position)
Erases an element from an unordered_set.
float max_load_factor() const noexcept
Returns a positive number that the unordered_multiset tries to keep the load factor less than or equa...
ISO C++ entities toplevel namespace is std.
size_type max_size() const noexcept
Returns the maximum size of the unordered_multiset.
void reserve(size_type __n)
Prepare the unordered_multiset for a specified number of elements.
unordered_set & operator=(initializer_list< value_type > __l)
Unordered_set list assignment operator.
iterator insert(value_type &&__x)
Inserts an element into the unordered_multiset.
iterator insert(const_iterator __hint, value_type &&__x)
Inserts an element into the unordered_multiset.
iterator find(const key_type &__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.
unordered_set()=default
Default constructor.
float load_factor() const noexcept
Returns the average number of elements per bucket.
key_equal key_eq() const
Returns the key comparison object with which the unordered_set was constructed.
_Hashtable::hasher hasher
Public typedefs.
_Hashtable::local_iterator local_iterator
Iterator-related typedefs.
iterator begin() noexcept
_Hashtable::const_pointer const_pointer
Iterator-related typedefs.
const_iterator end() const noexcept
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
_Hashtable::size_type size_type
Iterator-related typedefs.
void max_load_factor(float __z)
Change the unordered_multiset maximum load factor.
void max_load_factor(float __z)
Change the unordered_set maximum load factor.
hasher hash_function() const
Returns the hash functor object with which the unordered_multiset was constructed.
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 swap(unordered_set &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_set.
size_type count(const key_type &__x) const
Finds the number of elements.
_Hashtable::value_type value_type
Public typedefs.
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 __position)
Erases an element from an unordered_multiset.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_multiset.
iterator insert(const value_type &__x)
Inserts an element into the unordered_multiset.
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_set.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_set.
std::pair< iterator, bool > emplace(_Args &&... __args)
Attempts to build and insert an element into the unordered_set.
size_type max_size() const noexcept
Returns the maximum size of 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 erase(const key_type &__x)
Erases elements according to the provided key.
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.
void insert(initializer_list< value_type > __l)
Inserts a list of elements into the unordered_multiset.
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
_Hashtable::key_equal key_equal
Public typedefs.
_Hashtable::hasher hasher
Public typedefs.
iterator emplace(_Args &&... __args)
Builds and insert an element into the unordered_multiset.
_GLIBCXX_NODISCARD bool empty() const noexcept
Returns true if the unordered_multiset is empty.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
unordered_multiset(const allocator_type &__a)
Creates an unordered_multiset with no elements.
iterator begin() noexcept
hasher hash_function() const
Returns the hash functor object with which the unordered_set was constructed.
const_iterator cbegin() const noexcept
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_multiset.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Inserts an element into the unordered_multiset.
const_iterator begin() const noexcept
float load_factor() const noexcept
Returns the average number of elements per bucket.
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const
Finds a subsequence matching given key.
_GLIBCXX_NODISCARD bool empty() const noexcept
Returns true if the unordered_set is empty.
_Hashtable::key_type key_type
Public typedefs.
iterator emplace_hint(const_iterator __pos, _Args &&... __args)
Attempts to insert an element into the unordered_set.
_Hashtable::allocator_type allocator_type
Public typedefs.
_Hashtable::pointer pointer
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.
allocator_type get_allocator() const noexcept
Returns the allocator object used by the unordered_set.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element.
One of the comparison functors.
Struct holding two objects of arbitrary type.
_Hashtable::reference reference
Iterator-related typedefs.
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multiset.
unordered_set(const allocator_type &__a)
Creates an unordered_set with no elements.
Default ranged hash function H. In principle it should be a function object composed from objects of ...
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
iterator erase(iterator __position)
Erases an element from an unordered_multiset.
_Hashtable::const_reference const_reference
Iterator-related typedefs.
const_iterator cend() const noexcept
const_iterator find(const key_type &__x) const
Tries to locate an element in an unordered_set.
_Hashtable::const_iterator const_iterator
Iterator-related typedefs.
unordered_multiset & operator=(initializer_list< value_type > __l)
Unordered_multiset list assignment operator.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
size_type size() const noexcept
Returns the size of the unordered_multiset.
_Hashtable::difference_type difference_type
Iterator-related typedefs.
const_local_iterator cbegin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
const_local_iterator cend(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.
_Hashtable::key_type key_type
Public typedefs.
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs.
size_type count(const key_type &__x) const
Finds the number of elements.
Default range hashing function: use division to fold a large number into the range [0,...
_Hashtable::iterator iterator
Iterator-related typedefs.
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_set.
A standard container composed of unique keys (containing at most one of each key value) in which the ...
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.
const_local_iterator begin(size_type __n) const
Returns a read-only (constant) iterator pointing to the first bucket element.
unordered_multiset & operator=(const unordered_multiset &)=default
Copy assignment operator.
unordered_multiset()=default
Default constructor.
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key.
_Hashtable::size_type size_type
Iterator-related typedefs.
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert an element into the unordered_set.
const_local_iterator end(size_type __n) const
Returns a read-only (constant) iterator pointing to one past the last bucket elements.