30 #ifndef _UNORDERED_SET_H 
   31 #define _UNORDERED_SET_H 
   33 namespace std _GLIBCXX_VISIBILITY(default)
 
   35 _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
   41   template<
typename _Value,
 
   47                     __detail::_Identity, _Pred, _Hash,
 
   56   template<
typename _Value,
 
   64                      __detail::_Mod_range_hashing,
 
   65                      __detail::_Default_ranged_hash,
 
   66                      __detail::_Prime_rehash_policy, _Tr>;
 
   89   template<
class _Value,
 
  104       typedef typename _Hashtable::hasher   
hasher;
 
  133             const hasher& __hf = 
hasher(),
 
  136       : _M_h(__n, __hf, __eql, __a)
 
  152       template<
typename _InputIterator>
 
  155               const hasher& __hf = 
hasher(),
 
  158     : _M_h(__f, __l, __n, __hf, __eql, __a)
 
  182             const allocator_type& __a)
 
  183     : _M_h(__uset._M_h, __a)
 
  192             const allocator_type& __a)
 
  193     : _M_h(
std::
move(__uset._M_h), __a)
 
  209             const hasher& __hf = 
hasher(),
 
  212     : _M_h(__l, __n, __hf, __eql, __a)
 
  245       { 
return _M_h.get_allocator(); }
 
  252       { 
return _M_h.empty(); }
 
  257       { 
return _M_h.size(); }
 
  262       { 
return _M_h.max_size(); }
 
  273       { 
return _M_h.begin(); }
 
  277       { 
return _M_h.begin(); }
 
  287       { 
return _M_h.end(); }
 
  291       { 
return _M_h.end(); }
 
  300       { 
return _M_h.begin(); }
 
  308       { 
return _M_h.end(); }
 
  327       template<
typename... _Args>
 
  330     { 
return _M_h.emplace(std::forward<_Args>(__args)...); }
 
  353       template<
typename... _Args>
 
  356     { 
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
 
  374       { 
return _M_h.insert(__x); }
 
  402       insert(const_iterator __hint, 
const value_type& __x)
 
  403       { 
return _M_h.insert(__hint, __x); }
 
  406       insert(const_iterator __hint, value_type&& __x)
 
  407       { 
return _M_h.insert(__hint, 
std::move(__x)); }
 
  419       template<
typename _InputIterator>
 
  421     insert(_InputIterator __first, _InputIterator __last)
 
  422     { _M_h.insert(__first, __last); }
 
  433       { _M_h.insert(__l); }
 
  451       { 
return _M_h.erase(__position); }
 
  456       { 
return _M_h.erase(__it); }
 
  473       { 
return _M_h.erase(__x); }
 
  490       erase(const_iterator __first, const_iterator __last)
 
  491       { 
return _M_h.erase(__first, __last); }
 
  514       noexcept( noexcept(_M_h.swap(__x._M_h)) )
 
  515       { _M_h.swap(__x._M_h); }
 
  523       { 
return _M_h.hash_function(); }
 
  529       { 
return _M_h.key_eq(); }
 
  547       { 
return _M_h.find(__x); }
 
  550       find(
const key_type& __x)
 const 
  551       { 
return _M_h.find(__x); }
 
  565       { 
return _M_h.count(__x); }
 
  578       { 
return _M_h.equal_range(__x); }
 
  582       { 
return _M_h.equal_range(__x); }
 
  590       { 
return _M_h.bucket_count(); }
 
  595       { 
return _M_h.max_bucket_count(); }
 
  603       bucket_size(size_type __n)
 const 
  604       { 
return _M_h.bucket_size(__n); }
 
  612       bucket(
const key_type& __key)
 const 
  613       { 
return _M_h.bucket(__key); }
 
  624       { 
return _M_h.begin(__n); }
 
  628       { 
return _M_h.begin(__n); }
 
  632       { 
return _M_h.cbegin(__n); }
 
  644       { 
return _M_h.end(__n); }
 
  648       { 
return _M_h.end(__n); }
 
  652       { 
return _M_h.cend(__n); }
 
  660       { 
return _M_h.load_factor(); }
 
  666       { 
return _M_h.max_load_factor(); }
 
  674       { _M_h.max_load_factor(__z); }
 
  685       { _M_h.rehash(__n); }
 
  696       { _M_h.reserve(__n); }
 
  698       template<
typename _Value1, 
typename _Hash1, 
typename _Pred1,
 
  724   template<
class _Value,
 
  725        class _Hash = hash<_Value>,
 
  739       typedef typename _Hashtable::hasher   
hasher;
 
  768              const hasher& __hf = 
hasher(),
 
  771       : _M_h(__n, __hf, __eql, __a)
 
  787       template<
typename _InputIterator>
 
  790                const hasher& __hf = 
hasher(),
 
  793     : _M_h(__f, __l, __n, __hf, __eql, __a)
 
  815              const hasher& __hf = 
hasher(),
 
  818     : _M_h(__l, __n, __hf, __eql, __a)
 
  844              const allocator_type& __a)
 
  845     : _M_h(__umset._M_h, __a)
 
  854              const allocator_type& __a)
 
  855     : _M_h(
std::
move(__umset._M_h), __a)
 
  880       { 
return _M_h.get_allocator(); }
 
  887       { 
return _M_h.empty(); }
 
  892       { 
return _M_h.size(); }
 
  897       { 
return _M_h.max_size(); }
 
  908       { 
return _M_h.begin(); }
 
  912       { 
return _M_h.begin(); }
 
  922       { 
return _M_h.end(); }
 
  926       { 
return _M_h.end(); }
 
  935       { 
return _M_h.begin(); }
 
  943       { 
return _M_h.end(); }
 
  954       template<
typename... _Args>
 
  957     { 
return _M_h.emplace(std::forward<_Args>(__args)...); }
 
  976       template<
typename... _Args>
 
  979     { 
return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); }
 
  991       { 
return _M_h.insert(__x); }
 
 1016       insert(const_iterator __hint, 
const value_type& __x)
 
 1017       { 
return _M_h.insert(__hint, __x); }
 
 1020       insert(const_iterator __hint, value_type&& __x)
 
 1021       { 
return _M_h.insert(__hint, 
std::move(__x)); }
 
 1032       template<
typename _InputIterator>
 
 1034     insert(_InputIterator __first, _InputIterator __last)
 
 1035     { _M_h.insert(__first, __last); }
 
 1046       { _M_h.insert(__l); }
 
 1065       { 
return _M_h.erase(__position); }
 
 1070       { 
return _M_h.erase(__it); }
 
 1088       { 
return _M_h.erase(__x); }
 
 1107       erase(const_iterator __first, const_iterator __last)
 
 1108       { 
return _M_h.erase(__first, __last); }
 
 1132       noexcept( noexcept(_M_h.swap(__x._M_h)) )
 
 1133       { _M_h.swap(__x._M_h); }
 
 1141       { 
return _M_h.hash_function(); }
 
 1147       { 
return _M_h.key_eq(); }
 
 1165       { 
return _M_h.find(__x); }
 
 1169       { 
return _M_h.find(__x); }
 
 1179       { 
return _M_h.count(__x); }
 
 1190       { 
return _M_h.equal_range(__x); }
 
 1194       { 
return _M_h.equal_range(__x); }
 
 1202       { 
return _M_h.bucket_count(); }
 
 1207       { 
return _M_h.max_bucket_count(); }
 
 1215       bucket_size(size_type __n)
 const 
 1216       { 
return _M_h.bucket_size(__n); }
 
 1224       bucket(
const key_type& __key)
 const 
 1225       { 
return _M_h.bucket(__key); }
 
 1236       { 
return _M_h.begin(__n); }
 
 1238       const_local_iterator
 
 1240       { 
return _M_h.begin(__n); }
 
 1242       const_local_iterator
 
 1244       { 
return _M_h.cbegin(__n); }
 
 1256       { 
return _M_h.end(__n); }
 
 1258       const_local_iterator
 
 1260       { 
return _M_h.end(__n); }
 
 1262       const_local_iterator
 
 1264       { 
return _M_h.cend(__n); }
 
 1272       { 
return _M_h.load_factor(); }
 
 1278       { 
return _M_h.max_load_factor(); }
 
 1286       { _M_h.max_load_factor(__z); }
 
 1297       { _M_h.rehash(__n); }
 
 1308       { _M_h.reserve(__n); }
 
 1310       template<
typename _Value1, 
typename _Hash1, 
typename _Pred1,
 
 1317   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1319     swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1320      unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1323   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1325     swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1326      unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1329   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1331     operator==(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1332            const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1333     { 
return __x._M_h._M_equal(__y._M_h); }
 
 1335   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1337     operator!=(
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1338            const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1339     { 
return !(__x == __y); }
 
 1341   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1343     operator==(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1344            const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1345     { 
return __x._M_h._M_equal(__y._M_h); }
 
 1347   template<
class _Value, 
class _Hash, 
class _Pred, 
class _Alloc>
 
 1349     operator!=(
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
 
 1350            const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
 
 1351     { 
return !(__x == __y); }
 
 1353 _GLIBCXX_END_NAMESPACE_CONTAINER
 
const_iterator end() const noexcept
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const 
Finds a subsequence matching given key. 
size_type max_size() const noexcept
Returns the maximum size of the unordered_multiset. 
unordered_set(const allocator_type &__a)
Creates an unordered_set with no elements. 
void max_load_factor(float __z)
Change the unordered_set maximum load factor. 
local_iterator end(size_type __n)
Returns a read-only (constant) iterator pointing to one past the last bucket elements. 
_Hashtable::local_iterator local_iterator
Iterator-related typedefs. 
const_iterator begin() const noexcept
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue. 
iterator insert(const_iterator __hint, const value_type &__x)
Inserts an element into the unordered_multiset. 
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key. 
size_type count(const key_type &__x) const 
Finds the number of elements. 
bool empty() const noexcept
Returns true if the unordered_set is empty. 
std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const 
Finds a subsequence matching given key. 
float load_factor() const noexcept
Returns the average number of elements per bucket. 
unordered_set & operator=(const unordered_set &)=default
Copy assignment operator. 
const_local_iterator begin(size_type __n) const 
Returns a read-only (constant) iterator pointing to the first bucket element. 
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Attempts to insert an element into the unordered_set. 
iterator erase(iterator __it)
Erases an element from an unordered_set. 
unordered_multiset & operator=(initializer_list< value_type > __l)
Unordered_multiset list assignment operator. 
void insert(_InputIterator __first, _InputIterator __last)
A template function that attempts to insert a range of elements. 
size_type size() const noexcept
Returns the size of the unordered_set. 
_Hashtable::reference reference
Iterator-related typedefs. 
_Hashtable::pointer pointer
Iterator-related typedefs. 
iterator insert(const value_type &__x)
Inserts an element into the unordered_multiset. 
iterator emplace_hint(const_iterator __pos, _Args &&...__args)
Inserts an element into the unordered_multiset. 
_Hashtable::value_type value_type
Public typedefs. 
bool empty() const noexcept
Returns true if the unordered_multiset is empty. 
float load_factor() const noexcept
Returns the average number of elements per bucket. 
unordered_set & operator=(initializer_list< value_type > __l)
Unordered_set list assignment operator. 
iterator erase(iterator __it)
Erases an element from an unordered_multiset. 
_Hashtable::key_equal key_equal
Public typedefs. 
allocator_type get_allocator() const noexcept
Returns the allocator object with which the unordered_set was constructed. 
void rehash(size_type __n)
May rehash the unordered_set. 
void max_load_factor(float __z)
Change the unordered_multiset maximum load factor. 
void swap(unordered_set &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_set. 
iterator insert(const_iterator __hint, value_type &&__x)
Inserts an element into the unordered_multiset. 
const_iterator cbegin() const noexcept
unordered_set(_InputIterator __f, _InputIterator __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 a range. 
_Hashtable::size_type size_type
Iterator-related typedefs. 
const_local_iterator cend(size_type __n) const 
Returns a read-only (constant) iterator pointing to one past the last bucket elements. 
size_type erase(const key_type &__x)
Erases elements according to the provided key. 
const_iterator begin() const noexcept
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_multiset. 
_Hashtable::iterator iterator
Iterator-related typedefs. 
_Hashtable::const_reference const_reference
Iterator-related typedefs. 
std::pair< iterator, bool > insert(value_type &&__x)
Attempts to insert an element into the unordered_set. 
Default ranged hash function H. In principle it should be a function object composed from objects of ...
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. 
const_iterator cend() const noexcept
key_equal key_eq() const 
Returns the key comparison object with which the unordered_multiset was constructed. 
_Hashtable::value_type value_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. 
size_type size() const noexcept
Returns the size of the 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_set. 
_Hashtable::size_type size_type
Iterator-related typedefs. 
iterator find(const key_type &__x)
Tries to locate an element in an unordered_set. 
A standard container composed of unique keys (containing at most one of each key value) in which the ...
_Hashtable::const_iterator const_iterator
Iterator-related typedefs. 
const_local_iterator begin(size_type __n) const 
Returns a read-only (constant) iterator pointing to the first bucket element. 
void insert(_InputIterator __first, _InputIterator __last)
A template function that inserts a range of elements. 
_Hashtable::allocator_type allocator_type
Public typedefs. 
ISO C++ entities toplevel namespace is std. 
unordered_set(size_type __n=10, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements. 
const_iterator end() const noexcept
void insert(initializer_list< value_type > __l)
Attempts to insert a list of elements into the unordered_set. 
_Hashtable::const_pointer const_pointer
Iterator-related typedefs. 
key_equal key_eq() const 
Returns the key comparison object with which the unordered_set was constructed. 
const_iterator find(const key_type &__x) const 
Tries to locate an element in an unordered_multiset. 
_Hashtable::pointer pointer
Iterator-related typedefs. 
unordered_multiset(_InputIterator __f, _InputIterator __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 a range. 
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. 
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. 
void swap(unordered_multiset &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))
Swaps data with another unordered_multiset. 
_Hashtable::reference reference
Iterator-related typedefs. 
iterator insert(value_type &&__x)
Inserts an element into the unordered_multiset. 
The standard allocator, as per [20.4]. 
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs. 
One of the comparison functors. 
_Hashtable::const_pointer const_pointer
Iterator-related typedefs. 
_Hashtable::const_iterator const_iterator
Iterator-related typedefs. 
unordered_multiset(const allocator_type &__a)
Creates an unordered_multiset with no elements. 
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. 
_Hashtable::const_reference const_reference
Iterator-related typedefs. 
unordered_multiset(size_type __n=10, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
Default constructor creates no elements. 
const_iterator cend() const noexcept
size_type max_bucket_count() const noexcept
Returns the maximum 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...
iterator begin() noexcept
const_iterator find(const key_type &__x) const 
Tries to locate an element in an unordered_set. 
iterator begin() noexcept
allocator_type get_allocator() const noexcept
Returns the allocator object with which the unordered_multiset was constructed. 
std::pair< iterator, iterator > equal_range(const key_type &__x)
Finds a subsequence matching given key. 
iterator find(const key_type &__x)
Tries to locate an element in an unordered_multiset. 
Default value for rehash policy. Bucket size is (usually) the smallest prime that keeps the load fact...
_Hashtable::hasher hasher
Public typedefs. 
_Hashtable::local_iterator local_iterator
Iterator-related typedefs. 
void reserve(size_type __n)
Prepare the unordered_multiset for a specified number of elements. 
_Hashtable::difference_type difference_type
Iterator-related typedefs. 
Node const_iterators, used to iterate through all the hashtable. 
void insert(initializer_list< value_type > __l)
Inserts a list of elements into the unordered_multiset. 
_Hashtable::key_type key_type
Public typedefs. 
size_type bucket_count() const noexcept
Returns the number of buckets of the unordered_set. 
Primary class template hash. 
_Hashtable::iterator iterator
Iterator-related typedefs. 
A standard container composed of equivalent keys (possibly containing multiple of each key value) in ...
hasher hash_function() const 
Returns the hash functor object with which the unordered_multiset was constructed. 
unordered_multiset & operator=(const unordered_multiset &)=default
Copy assignment operator. 
iterator insert(const_iterator __hint, const 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. 
size_type max_size() const noexcept
Returns the maximum size of the unordered_set. 
_Hashtable::allocator_type allocator_type
Public typedefs. 
iterator erase(const_iterator __position)
Erases an element from an unordered_set. 
void reserve(size_type __n)
Prepare the unordered_set for a specified number of elements. 
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_set. 
_Hashtable::hasher hasher
Public typedefs. 
_Hashtable::difference_type difference_type
Iterator-related typedefs. 
Struct holding two objects of arbitrary type. 
iterator emplace(_Args &&...__args)
Builds and insert an element into the unordered_multiset. 
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values. 
iterator erase(const_iterator __first, const_iterator __last)
Erases a [__first,__last) range of elements from an unordered_multiset. 
iterator insert(const_iterator __hint, value_type &&__x)
Attempts to insert an element into the unordered_set. 
void rehash(size_type __n)
May rehash the unordered_multiset. 
const_local_iterator cbegin(size_type __n) const 
Returns a read-only (constant) iterator pointing to the first bucket element. 
hasher hash_function() const 
Returns the hash functor object with which the unordered_set was constructed. 
size_type erase(const key_type &__x)
Erases elements according to the provided key. 
const_iterator cbegin() const noexcept
std::pair< iterator, bool > insert(const value_type &__x)
Attempts to insert an element into the unordered_set. 
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element. 
Node iterators, used to iterate through all the hashtable. 
_Hashtable::key_type key_type
Public typedefs. 
local_iterator begin(size_type __n)
Returns a read-only (constant) iterator pointing to the first bucket element. 
std::pair< iterator, bool > emplace(_Args &&...__args)
Attempts to build and 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...
_Hashtable::const_local_iterator const_local_iterator
Iterator-related typedefs. 
Default range hashing function: use division to fold a large number into the range [0...
const_local_iterator cbegin(size_type __n) const 
Returns a read-only (constant) iterator pointing to the first bucket element.