GNU g++  v5.2.1
GNU Standard C++
unordered_set.h File Reference

This is an internal header file, included by other library headers. More...

Functions

namespace std _GLIBCXX_VISIBILITY (default)
 

Detailed Description

This is an internal header file, included by other library headers.

Do not attempt to use it directly. {unordered_set}

Function Documentation

namespace std _GLIBCXX_VISIBILITY ( default  )

Base types for unordered_set.

Base types for unordered_multiset.

A standard container composed of unique keys (containing at most one of each key value) in which the elements' keys are the elements themselves.

Template Parameters
_ValueType of key objects.
_HashHashing function object type, defaults to hash<_Value>.
_PredPredicate function object type, defaults to equal_to<_Value>.
_AllocAllocator type, defaults to allocator<_Key>.

Meets the requirements of a container, and unordered associative container

Base is _Hashtable, dispatched at compile time via template alias __uset_hashtable.

Public typedefs.

Iterator-related typedefs.

Default constructor.

Default constructor creates no elements.

Parameters
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Builds an unordered_set from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Create an unordered_set consisting of copies of the elements from [__first,__last). This is linear in N (where N is distance(__first,__last)).

Copy constructor.

Move constructor.

Creates an unordered_set with no elements.

Parameters
__aAn allocator object.

Builds an unordered_set from an initializer_list.

Parameters
__lAn initializer_list.
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Create an unordered_set consisting of copies of the elements in the list. This is linear in N (where N is __l.size()).

Copy assignment operator.

Move assignment operator.

Unordered_set list assignment operator.

Parameters
__lAn initializer_list.

This function fills an unordered_set with copies of the elements in the initializer list __l.

Note that the assignment completely changes the unordered_set and that the resulting unordered_set's size is the same as the number of elements assigned. Old data may be lost.

Returns the allocator object with which the unordered_set was constructed.

Returns true if the unordered_set is empty.

Returns the size of the unordered_set.

Returns the maximum size of the unordered_set.

Returns a read-only (constant) iterator that points to the first element in the unordered_set.

Returns a read-only (constant) iterator that points one past the last element in the unordered_set.

Returns a read-only (constant) iterator that points to the first element in the unordered_set.

Returns a read-only (constant) iterator that points one past the last element in the unordered_set.

Attempts to build and insert an element into the unordered_set.

Parameters
__argsArguments used to generate an element.
Returns
A pair, of which the first element is an iterator that points to the possibly inserted element, and the second is a bool that is true if the element was actually inserted.

This function attempts to build and insert an element into the unordered_set. An unordered_set relies on unique keys and thus an element is only inserted if it is not already present in the unordered_set.

Insertion requires amortized constant time.

Attempts to insert an element into the unordered_set.

Parameters
__posAn iterator that serves as a hint as to where the element should be inserted.
__argsArguments used to generate the element to be inserted.
Returns
An iterator that points to the element with key equivalent to the one generated from __args (may or may not be the element itself).

This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument emplace() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Insertion requires amortized constant time.

Attempts to insert an element into the unordered_set.

Parameters
__xElement to be inserted.
Returns
A pair, of which the first element is an iterator that points to the possibly inserted element, and the second is a bool that is true if the element was actually inserted.

This function attempts to insert an element into the unordered_set. An unordered_set relies on unique keys and thus an element is only inserted if it is not already present in the unordered_set.

Insertion requires amortized constant time.

Attempts to insert an element into the unordered_set.

Parameters
__hintAn iterator that serves as a hint as to where the element should be inserted.
__xElement to be inserted.
Returns
An iterator that points to the element with key of __x (may or may not be the element passed in).

This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument insert() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Insertion requires amortized constant.

A template function that attempts to insert a range of elements.

Parameters
__firstIterator pointing to the start of the range to be inserted.
__lastIterator pointing to the end of the range.

Complexity similar to that of the range constructor.

Attempts to insert a list of elements into the unordered_set.

Parameters
__lA std::initializer_list<value_type> of elements to be inserted.

Complexity similar to that of the range constructor.

Erases an element from an unordered_set.

Parameters
__positionAn iterator pointing to the element to be erased.
Returns
An iterator pointing to the element immediately following __position prior to the element being erased. If no such element exists, end() is returned.

This function erases an element, pointed to by the given iterator, from an unordered_set. Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases elements according to the provided key.

Parameters
__xKey of element to be erased.
Returns
The number of elements erased.

This function erases all the elements located by the given key from an unordered_set. For an unordered_set the result of this function can only be 0 (not present) or 1 (present). Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases a [__first,__last) range of elements from an unordered_set.

Parameters
__firstIterator pointing to the start of the range to be erased.
__lastIterator pointing to the end of the range to be erased.
Returns
The iterator __last.

This function erases a sequence of elements from an unordered_set. Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases all elements in an unordered_set. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another unordered_set.

Parameters
__xAn unordered_set of the same element and allocator types.

This exchanges the elements between two sets in constant time. Note that the global std::swap() function is specialized such that std::swap(s1,s2) will feed to this function.

Returns the hash functor object with which the unordered_set was constructed.

Returns the key comparison object with which the unordered_set was constructed.

Tries to locate an element in an unordered_set.

Parameters
__xElement to be located.
Returns
Iterator pointing to sought-after element, or end() if not found.

This function takes a key and tries to locate the element with which the key matches. If successful the function returns an iterator pointing to the sought after element. If unsuccessful it returns the past-the-end ( end() ) iterator.

Finds the number of elements.

Parameters
__xElement to located.
Returns
Number of elements with specified key.

This function only makes sense for unordered_multisets; for unordered_set the result will either be 0 (not present) or 1 (present).

Finds a subsequence matching given key.

Parameters
__xKey to be located.
Returns
Pair of iterators that possibly points to the subsequence matching given key.

This function probably only makes sense for multisets.

Returns the number of buckets of the unordered_set.

Returns the maximum number of buckets of the unordered_set.

Returns a read-only (constant) iterator pointing to the first bucket element.

Parameters
__nThe bucket index.
Returns
A read-only local iterator.

Returns a read-only (constant) iterator pointing to one past the last bucket elements.

Parameters
__nThe bucket index.
Returns
A read-only local iterator.

Returns the average number of elements per bucket.

Returns a positive number that the unordered_set tries to keep the load factor less than or equal to.

Change the unordered_set maximum load factor.

Parameters
__zThe new maximum load factor.

May rehash the unordered_set.

Parameters
__nThe new number of buckets.

Rehash will occur only if the new number of buckets respect the unordered_set maximum load factor.

Prepare the unordered_set for a specified number of elements.

Parameters
__nNumber of elements required.

Same as rehash(ceil(n / max_load_factor())).

A standard container composed of equivalent keys (possibly containing multiple of each key value) in which the elements' keys are the elements themselves.

Template Parameters
_ValueType of key objects.
_HashHashing function object type, defaults to hash<_Value>.
_PredPredicate function object type, defaults to equal_to<_Value>.
_AllocAllocator type, defaults to allocator<_Key>.

Meets the requirements of a container, and unordered associative container

Base is _Hashtable, dispatched at compile time via template alias __umset_hashtable.

Public typedefs.

Iterator-related typedefs.

Default constructor.

Default constructor creates no elements.

Parameters
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Builds an unordered_multiset from a range.

Parameters
__firstAn input iterator.
__lastAn input iterator.
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Create an unordered_multiset consisting of copies of the elements from [__first,__last). This is linear in N (where N is distance(__first,__last)).

Copy constructor.

Move constructor.

Builds an unordered_multiset from an initializer_list.

Parameters
__lAn initializer_list.
__nMinimal initial number of buckets.
__hfA hash functor.
__eqlA key equality functor.
__aAn allocator object.

Create an unordered_multiset consisting of copies of the elements in the list. This is linear in N (where N is __l.size()).

Copy assignment operator.

Move assignment operator.

Creates an unordered_multiset with no elements.

Parameters
__aAn allocator object.

Unordered_multiset list assignment operator.

Parameters
__lAn initializer_list.

This function fills an unordered_multiset with copies of the elements in the initializer list __l.

Note that the assignment completely changes the unordered_multiset and that the resulting unordered_multiset's size is the same as the number of elements assigned. Old data may be lost.

Returns the allocator object with which the unordered_multiset was constructed.

Returns true if the unordered_multiset is empty.

Returns the size of the unordered_multiset.

Returns the maximum size of the unordered_multiset.

Returns a read-only (constant) iterator that points to the first element in the unordered_multiset.

Returns a read-only (constant) iterator that points one past the last element in the unordered_multiset.

Returns a read-only (constant) iterator that points to the first element in the unordered_multiset.

Returns a read-only (constant) iterator that points one past the last element in the unordered_multiset.

Builds and insert an element into the unordered_multiset.

Parameters
__argsArguments used to generate an element.
Returns
An iterator that points to the inserted element.

Insertion requires amortized constant time.

Inserts an element into the unordered_multiset.

Parameters
__posAn iterator that serves as a hint as to where the element should be inserted.
__argsArguments used to generate the element to be inserted.
Returns
An iterator that points to the inserted element.

Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Insertion requires amortized constant time.

Inserts an element into the unordered_multiset.

Parameters
__xElement to be inserted.
Returns
An iterator that points to the inserted element.

Insertion requires amortized constant time.

Inserts an element into the unordered_multiset.

Parameters
__hintAn iterator that serves as a hint as to where the element should be inserted.
__xElement to be inserted.
Returns
An iterator that points to the inserted element.

Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Insertion requires amortized constant.

A template function that inserts a range of elements.

Parameters
__firstIterator pointing to the start of the range to be inserted.
__lastIterator pointing to the end of the range.

Complexity similar to that of the range constructor.

Inserts a list of elements into the unordered_multiset.

Parameters
__lA std::initializer_list<value_type> of elements to be inserted.

Complexity similar to that of the range constructor.

Erases an element from an unordered_multiset.

Parameters
__positionAn iterator pointing to the element to be erased.
Returns
An iterator pointing to the element immediately following __position prior to the element being erased. If no such element exists, end() is returned.

This function erases an element, pointed to by the given iterator, from an unordered_multiset.

Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases elements according to the provided key.

Parameters
__xKey of element to be erased.
Returns
The number of elements erased.

This function erases all the elements located by the given key from an unordered_multiset.

Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases a [__first,__last) range of elements from an unordered_multiset.

Parameters
__firstIterator pointing to the start of the range to be erased.
__lastIterator pointing to the end of the range to be erased.
Returns
The iterator __last.

This function erases a sequence of elements from an unordered_multiset.

Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Erases all elements in an unordered_multiset.

Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.

Swaps data with another unordered_multiset.

Parameters
__xAn unordered_multiset of the same element and allocator types.

This exchanges the elements between two sets in constant time. Note that the global std::swap() function is specialized such that std::swap(s1,s2) will feed to this function.

Returns the hash functor object with which the unordered_multiset was constructed.

Returns the key comparison object with which the unordered_multiset was constructed.

Tries to locate an element in an unordered_multiset.

Parameters
__xElement to be located.
Returns
Iterator pointing to sought-after element, or end() if not found.

This function takes a key and tries to locate the element with which the key matches. If successful the function returns an iterator pointing to the sought after element. If unsuccessful it returns the past-the-end ( end() ) iterator.

Finds the number of elements.

Parameters
__xElement to located.
Returns
Number of elements with specified key.

Finds a subsequence matching given key.

Parameters
__xKey to be located.
Returns
Pair of iterators that possibly points to the subsequence matching given key.

Returns the number of buckets of the unordered_multiset.

Returns the maximum number of buckets of the unordered_multiset.

Returns a read-only (constant) iterator pointing to the first bucket element.

Parameters
__nThe bucket index.
Returns
A read-only local iterator.

Returns a read-only (constant) iterator pointing to one past the last bucket elements.

Parameters
__nThe bucket index.
Returns
A read-only local iterator.

Returns the average number of elements per bucket.

Returns a positive number that the unordered_multiset tries to keep the load factor less than or equal to.

Change the unordered_multiset maximum load factor.

Parameters
__zThe new maximum load factor.

May rehash the unordered_multiset.

Parameters
__nThe new number of buckets.

Rehash will occur only if the new number of buckets respect the unordered_multiset maximum load factor.

Prepare the unordered_multiset for a specified number of elements.

Parameters
__nNumber of elements required.

Same as rehash(ceil(n / max_load_factor())).

References std::__exception_ptr::operator!=(), std::__exception_ptr::operator==(), and std::__exception_ptr::swap().

Here is the call graph for this function: