GNU g++  v5.2.1
GNU Standard C++
unordered_map.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_map}

Function Documentation

namespace std _GLIBCXX_VISIBILITY ( default  )

Base types for unordered_map.

Base types for unordered_multimap.

A standard container composed of unique keys (containing at most one of each key value) that associates values of another type with the keys.

Template Parameters
_KeyType of key objects.
_TpType of mapped objects.
_HashHashing function object type, defaults to hash<_Value>.
_PredPredicate function object type, defaults to equal_to<_Value>.
_AllocAllocator type, defaults to std::allocator<std::pair<const _Key, _Tp>>.

Meets the requirements of a container, and unordered associative container

The resulting value type of the container is std::pair<const _Key, _Tp>.

Base is _Hashtable, dispatched at compile time via template alias __umap_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_map 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_map 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_map with no elements.

Parameters
__aAn allocator object.

Builds an unordered_map 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_map 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_map list assignment operator.

Parameters
__lAn initializer_list.

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

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

Returns the allocator object with which the unordered_map was constructed.

Returns true if the unordered_map is empty.

Returns the size of the unordered_map.

Returns the maximum size of the unordered_map.

Returns a read/write iterator that points to the first element in the unordered_map.

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

Returns a read/write iterator that points one past the last element in the unordered_map.

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

Attempts to build and insert a std::pair into the unordered_map.

Parameters
__argsArguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Returns
A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.

This function attempts to build and insert a (key, value) pair into the unordered_map. An unordered_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered_map.

Insertion requires amortized constant time.

Attempts to build and insert a std::pair into the unordered_map.

Parameters
__posAn iterator that serves as a hint as to where the pair should be inserted.
__argsArguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Returns
An iterator that points to the element with key of the std::pair built from __args (may or may not be that std::pair).

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.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.

Insertion requires amortized constant time.

Attempts to insert a std::pair into the unordered_map.

Parameters
__xPair to be inserted (see std::make_pair for easy creation of pairs).
Returns
A pair, of which the first element is an iterator that points to the possibly inserted pair, and the second is a bool that is true if the pair was actually inserted.

This function attempts to insert a (key, value) pair into the unordered_map. An unordered_map relies on unique keys and thus a pair is only inserted if its first element (the key) is not already present in the unordered_map.

Insertion requires amortized constant time.

Attempts to insert a std::pair into the unordered_map.

Parameters
__hintAn iterator that serves as a hint as to where the pair should be inserted.
__xPair to be inserted (see std::make_pair for easy creation of pairs).
Returns
An iterator that points to the element with key of __x (may or may not be the pair 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.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.

Insertion requires amortized constant time.

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_map.

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_map.

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_map. 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_map. For an unordered_map 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_map.

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_map. Note that this function only erases the elements, 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_map. 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_map.

Parameters
__xAn unordered_map of the same element and allocator types.

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

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

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

Tries to locate an element in an unordered_map.

Parameters
__xKey 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
__xKey to count.
Returns
Number of elements with specified key.

This function only makes sense for unordered_multimap; for unordered_map 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 unordered_multimap.

Subscript ( [] ) access to unordered_map data.

Parameters
__kThe key for which data should be retrieved.
Returns
A reference to the data of the (key,data) pair.

Allows for easy lookup with the subscript ( [] )operator. Returns data associated with the key specified in subscript. If the key does not exist, a pair with that key is created using default values, which is then returned.

Lookup requires constant time.

Access to unordered_map data.

Parameters
__kThe key for which data should be retrieved.
Returns
A reference to the data whose key is equal to __k, if such a data is present in the unordered_map.
Exceptions
std::out_of_rangeIf no such data is present.

Returns the number of buckets of the unordered_map.

Returns the maximum number of buckets of the unordered_map.

Returns a read/write iterator pointing to the first bucket element.

Parameters
__nThe bucket index.
Returns
A read/write local iterator.

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/write iterator pointing to one past the last bucket elements.

Parameters
__nThe bucket index.
Returns
A read/write 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_map tries to keep the load factor less than or equal to.

Change the unordered_map maximum load factor.

Parameters
__zThe new maximum load factor.

May rehash the unordered_map.

Parameters
__nThe new number of buckets.

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

Prepare the unordered_map 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) that associates values of another type with the keys.

Template Parameters
_KeyType of key objects.
_TpType of mapped objects.
_HashHashing function object type, defaults to hash<_Value>.
_PredPredicate function object type, defaults to equal_to<_Value>.
_AllocAllocator type, defaults to std::allocator<std::pair<const _Key, _Tp>>.

Meets the requirements of a container, and unordered associative container

The resulting value type of the container is std::pair<const _Key, _Tp>.

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

Public typedefs.

Iterator-related typedefs.

Default constructor.

Default constructor creates no elements.

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

Builds an unordered_multimap 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_multimap 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_multimap with no elements.

Parameters
__aAn allocator object.

Builds an unordered_multimap 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_multimap 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_multimap list assignment operator.

Parameters
__lAn initializer_list.

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

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

Returns the allocator object with which the unordered_multimap was constructed.

Returns true if the unordered_multimap is empty.

Returns the size of the unordered_multimap.

Returns the maximum size of the unordered_multimap.

Returns a read/write iterator that points to the first element in the unordered_multimap.

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

Returns a read/write iterator that points one past the last element in the unordered_multimap.

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

Attempts to build and insert a std::pair into the unordered_multimap.

Parameters
__argsArguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Returns
An iterator that points to the inserted pair.

This function attempts to build and insert a (key, value) pair into the unordered_multimap.

Insertion requires amortized constant time.

Attempts to build and insert a std::pair into the unordered_multimap.

Parameters
__posAn iterator that serves as a hint as to where the pair should be inserted.
__argsArguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Returns
An iterator that points to the element with key of the std::pair built from __args.

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.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.

Insertion requires amortized constant time.

Inserts a std::pair into the unordered_multimap.

Parameters
__xPair to be inserted (see std::make_pair for easy creation of pairs).
Returns
An iterator that points to the inserted pair.

Insertion requires amortized constant time.

Inserts a std::pair into the unordered_multimap.

Parameters
__hintAn iterator that serves as a hint as to where the pair should be inserted.
__xPair to be inserted (see std::make_pair for easy creation of pairs).
Returns
An iterator that points to the element with key of __x (may or may not be the pair passed in).

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.

See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.

Insertion requires amortized constant time.

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_multimap.

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_multimap.

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_multimap. 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 elements to be erased.
Returns
The number of elements erased.

This function erases all the elements located by the given key from an unordered_multimap. 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_multimap.

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_multimap. Note that this function only erases the elements, 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_multimap. 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_multimap.

Parameters
__xAn unordered_multimap of the same element and allocator types.

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

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

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

Tries to locate an element in an unordered_multimap.

Parameters
__xKey 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
__xKey to count.
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_multimap.

Returns the maximum number of buckets of the unordered_multimap.

Returns a read/write iterator pointing to the first bucket element.

Parameters
__nThe bucket index.
Returns
A read/write local iterator.

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/write iterator pointing to one past the last bucket elements.

Parameters
__nThe bucket index.
Returns
A read/write 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_multimap tries to keep the load factor less than or equal to.

Change the unordered_multimap maximum load factor.

Parameters
__zThe new maximum load factor.

May rehash the unordered_multimap.

Parameters
__nThe new number of buckets.

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

Prepare the unordered_multimap 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: