Class unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>

#include <Geode/c++stl/gnustl/unordered_map.h>
template<class _Key,class _Tp,class _Hash = hash<_Key>,class _Pred = std::equal_to<_Key>,class _Alloc = std::allocator<std::pair<const _Key, _Tp> >>classunordered_map{ ... }

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

_Key

Type of key objects.

_Tp

Type of mapped objects.

_Hash

Hashing function object type, defaults to hash<_Value>.

_Pred

Predicate function object type, defaults to equal_to<_Value>.

_Alloc

Allocator type, defaults to std::allocator<std::pair<const _Key, _Tp>>. Meets the requirements of a <a href="tables.html#65">container</a>, and <a href="tables.html#xx">unordered associative container</a> 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.
Examples0
Public static methods0
Public member functions55
template<typename _InputIterator>voidunordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>(,,,,,)

Builds an %unordered_map from a range.

Parameters

__first

An input iterator.

__last

An input iterator.

__n

Minimal initial number of buckets.

__hf

A hash functor.

__eql

A key equality functor.

__a

An 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)).
geode::stl::unordered_map&operator=()

/// Copy assignment operator.

geode::stl::unordered_map&operator=()

/// Move assignment operator.

geode::stl::unordered_map&operator=()

%Unordered_map list assignment operator.

Parameters

__l

An initializer_list. This function fills an %unordered_map with copies of the elements in the initializer list
geode::stl::unordered_map::allocator_typeget_allocator()const

/// Returns the allocator object with which the %unordered_map was /// constructed.

boolempty()const

/// Returns true if the %unordered_map is empty.

geode::stl::unordered_map::size_typesize()const

/// Returns the size of the %unordered_map.

geode::stl::unordered_map::size_typemax_size()const

/// Returns the maximum size of the %unordered_map.

geode::stl::unordered_map::iteratorbegin()

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

geode::stl::unordered_map::const_iteratorbegin()const

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

geode::stl::unordered_map::const_iteratorcbegin()const
No description provided
geode::stl::unordered_map::iteratorend()

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

geode::stl::unordered_map::const_iteratorend()const

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

geode::stl::unordered_map::const_iteratorcend()const
No description provided
template<typename... _Args>std::pair<geode::stl::unordered_map::iterator,bool>emplace()

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

Parameters

__args

Arguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Return value
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.
template<typename... _Args>geode::stl::unordered_map::iteratoremplace_hint(,)

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

Parameters

__pos

An iterator that serves as a hint as to where the pair should be inserted.

__args

Arguments used to generate a new pair instance (see std::piecewise_contruct for passing arguments to each part of the pair constructor).
Return value
An iterator that points to the element with key of the std::pair built from
std::pair<geode::stl::unordered_map::iterator,bool>insert()

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

Parameters

__x

Pair to be inserted (see std::make_pair for easy creation of pairs).
Return value
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.
template<typename _Pair,typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type>std::pair<geode::stl::unordered_map::iterator,bool>insert()
No description provided
geode::stl::unordered_map::iteratorinsert(,)

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

Parameters

__hint

An iterator that serves as a hint as to where the pair should be inserted.

__x

Pair to be inserted (see std::make_pair for easy creation of pairs).
Return value
An iterator that points to the element with key of
template<typename _Pair,typename = typename std::enable_if<std::is_constructible<value_type, _Pair&&>::value>::type>geode::stl::unordered_map::iteratorinsert(,)
No description provided
template<typename _InputIterator>voidinsert(,)

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

Parameters

__first

Iterator pointing to the start of the range to be inserted.

__last

Iterator pointing to the end of the range. Complexity similar to that of the range constructor.
voidinsert()

Attempts to insert a list of elements into the %unordered_map.

Parameters

__l

A std::initializer_list<value_type> of elements to be inserted. Complexity similar to that of the range constructor.
geode::stl::unordered_map::iteratorerase()

Erases an element from an %unordered_map.

Parameters

__position

An iterator pointing to the element to be erased.
Return value
An iterator pointing to the element immediately following
geode::stl::unordered_map::iteratorerase()
No description provided
geode::stl::unordered_map::size_typeerase()

Erases elements according to the provided key.

Parameters

__x

Key of element to be erased.
Return value
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.
geode::stl::unordered_map::iteratorerase(,)

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

Parameters

__first

Iterator pointing to the start of the range to be erased.

__last

Iterator pointing to the end of the range to be erased.
Return value
The iterator
voidclear()

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.

voidswap()

Swaps data with another %unordered_map.

Parameters

__x

An %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.
geode::stl::unordered_map::hasherhash_function()const

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

geode::stl::unordered_map::key_equalkey_eq()const

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

geode::stl::unordered_map::iteratorfind()

Tries to locate an element in an %unordered_map.

Parameters

__x

Key to be located.
Return value
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 (
geode::stl::unordered_map::const_iteratorfind()const
No description provided
geode::stl::unordered_map::size_typecount()const

Finds the number of elements.

Parameters

__x

Key to count.
Return value
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).
boolcontains()const
No description provided
std::pair<geode::stl::unordered_map::iterator,geode::stl::unordered_map::iterator>equal_range()

Finds a subsequence matching given key.

Parameters

__x

Key to be located.
Return value
Pair of iterators that possibly points to the subsequence matching given key. This function probably only makes sense for %unordered_multimap.
std::pair<geode::stl::unordered_map::const_iterator,geode::stl::unordered_map::const_iterator>equal_range()const
No description provided
geode::stl::unordered_map::mapped_type&operator[]()

Subscript (

Parameters

__k

The key for which data should be retrieved.
Return value
A reference to the data of the (key,data) %pair. Allows for easy lookup with the subscript (
geode::stl::unordered_map::mapped_type&operator[]()
No description provided
geode::stl::unordered_map::mapped_type&at()

Access to %unordered_map data.

Parameters

__k

The key for which data should be retrieved.
Return value
A reference to the data whose key is equal to
geode::stl::unordered_map::mapped_typeconst&at()const
No description provided
geode::stl::unordered_map::size_typebucket_count()const

/// Returns the number of buckets of the %unordered_map.

geode::stl::unordered_map::size_typemax_bucket_count()const

/// Returns the maximum number of buckets of the %unordered_map.

geode::stl::unordered_map::size_typebucket_size()const
No description provided
geode::stl::unordered_map::size_typebucket()const
No description provided
geode::stl::unordered_map::local_iteratorbegin()

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

Parameters

__n

The bucket index.
Return value
A read/write local iterator.
geode::stl::unordered_map::const_local_iteratorbegin()const

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

Parameters

__n

The bucket index.
Return value
A read-only local iterator.
geode::stl::unordered_map::const_local_iteratorcbegin()const
No description provided
geode::stl::unordered_map::local_iteratorend()

Returns a read/write iterator pointing to one past the last bucket elements.

Parameters

__n

The bucket index.
Return value
A read/write local iterator.
geode::stl::unordered_map::const_local_iteratorend()const

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

Parameters

__n

The bucket index.
Return value
A read-only local iterator.
geode::stl::unordered_map::const_local_iteratorcend()const
No description provided
floatload_factor()const

/// Returns the average number of elements per bucket.

floatmax_load_factor()const

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

voidmax_load_factor()

Change the %unordered_map maximum load factor.

Parameters

__z

The new maximum load factor.
voidrehash()

May rehash the %unordered_map.

Parameters

__n

The new number of buckets. Rehash will occur only if the new number of buckets respect the %unordered_map maximum load factor.
voidreserve()

Prepare the %unordered_map for a specified number of elements.

Parameters

__n

Number of elements required. Same as rehash(ceil(n / max_load_factor())).
Fields0
Protected member functions0
Protected fields0