Open 3D Engine AzCore API Reference  2305.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator > Class Template Reference

#include <unordered_map.h>

Inherits AZStd::hash_table< Internal::UnorderedMapTableTraits< Key, MappedType, Hasher, EqualKey, Allocator, false > >.

Public Types

using traits_type = typename base_type::traits_type
 
using key_type = typename base_type::key_type
 
using key_equal = typename base_type::key_equal
 
using hasher = typename base_type::hasher
 
using mapped_type = MappedType
 
using allocator_type = typename base_type::allocator_type
 
using size_type = typename base_type::size_type
 
using difference_type = typename base_type::difference_type
 
using pointer = typename base_type::pointer
 
using const_pointer = typename base_type::const_pointer
 
using reference = typename base_type::reference
 
using const_reference = typename base_type::const_reference
 
using iterator = typename base_type::iterator
 
using const_iterator = typename base_type::const_iterator
 
using value_type = typename base_type::value_type
 
using local_iterator = typename base_type::local_iterator
 
using const_local_iterator = typename base_type::const_local_iterator
 
using pair_iter_bool = typename base_type::pair_iter_bool
 
using node_type = map_node_handle< map_node_traits< key_type, mapped_type, allocator_type, typename base_type::list_node_type, typename base_type::node_deleter >>
 
using insert_return_type = AssociativeInternal::insert_return_type< iterator, node_type >
 

Public Member Functions

 unordered_map (size_type numBucketsHint, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &allocator=allocator_type())
 
template<class InputIterator >
 unordered_map (InputIterator first, InputIterator last, size_type numBucketsHint={}, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &alloc=allocator_type())
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 unordered_map (from_range_t, R &&rg, size_type numBucketsHint={}, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &alloc=allocator_type())
 
 unordered_map (const unordered_map &rhs)
 
 unordered_map (unordered_map &&rhs)
 
 unordered_map (const allocator_type &alloc)
 
 unordered_map (const unordered_map &rhs, const type_identity_t< allocator_type > &alloc)
 
 unordered_map (unordered_map &&rhs, const type_identity_t< allocator_type > &alloc)
 
 unordered_map (initializer_list< value_type > list, size_type numBucketsHint={}, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &allocator=allocator_type())
 
 unordered_map (size_type numBucketsHint, const allocator_type &alloc)
 
 unordered_map (size_type numBucketsHint, const hasher &hash, const allocator_type &alloc)
 
template<class InputIterator >
 unordered_map (InputIterator f, InputIterator l, size_type n, const allocator_type &a)
 
template<class InputIterator >
 unordered_map (InputIterator f, InputIterator l, size_type n, const hasher &hf, const allocator_type &a)
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 unordered_map (from_range_t, R &&rg, size_type n, const allocator_type &a)
 
template<class R , class = enable_if_t<Internal::container_compatible_range<R, value_type>>>
 unordered_map (from_range_t, R &&rg, size_type n, const hasher &hf, const allocator_type &a)
 
 unordered_map (initializer_list< value_type > il, size_type n, const allocator_type &a)
 
 unordered_map (initializer_list< value_type > il, size_type n, const hasher &hf, const allocator_type &a)
 
 unordered_map (const hasher &hash, const key_equal &keyEqual, const allocator_type &allocator)
 This constructor is AZStd extension (so we don't rehash/allocate memory)
 
this_typeoperator= (this_type &&rhs)
 
AZ_FORCE_INLINE this_typeoperator= (const this_type &rhs)
 
AZ_FORCE_INLINE mapped_type & operator[] (const key_type &key)
 
AZ_FORCE_INLINE mapped_type & at (const key_type &key)
 
AZ_FORCE_INLINE const mapped_type & at (const key_type &key) const
 
insert_return_type insert (node_type &&nodeHandle)
 
iterator insert (const_iterator hint, node_type &&nodeHandle)
 
template<typename M >
pair_iter_bool insert_or_assign (const key_type &key, M &&value)
 
template<typename M >
pair_iter_bool insert_or_assign (key_type &&key, M &&value)
 
template<typename M >
iterator insert_or_assign (const_iterator hint, const key_type &key, M &&value)
 
template<typename M >
iterator insert_or_assign (const_iterator hint, key_type &&key, M &&value)
 
template<typename... Args>
pair_iter_bool try_emplace (const key_type &key, Args &&...arguments)
 
template<typename... Args>
pair_iter_bool try_emplace (key_type &&key, Args &&...arguments)
 
template<typename... Args>
iterator try_emplace (const_iterator hint, const key_type &key, Args &&...arguments)
 
template<typename... Args>
iterator try_emplace (const_iterator hint, key_type &&key, Args &&...arguments)
 
node_type extract (const key_type &key)
 
node_type extract (const_iterator it)
 
Extensions

AZ_FORCE_INLINE pair_iter_bool insert_key (const key_type &key)
 

Detailed Description

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
class AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >

Unordered map container is complaint with CTR1 (6.2.4.4) This is an associative container with pair(Key,MappedType), all Keys are unique. insert function will return false, if you try to add key that is in the map.

It has the following extensions from hash_table and UMapExtensions. Check the unordered_map AZStdExamples.

Member Function Documentation

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
AZ_FORCE_INLINE mapped_type& AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >::at ( const key_type &  key)
inline

Returns mapped type with based on the key, if the element doesn't exist an assert it triggered!

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
AZ_FORCE_INLINE pair_iter_bool AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >::insert_key ( const key_type &  key)
inline

Insert a pair with default value base on a key only (AKA lazy insert). This can be a speed up when the object has complicated assignment function.

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
template<typename M >
pair_iter_bool AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >::insert_or_assign ( const key_type &  key,
M &&  value 
)
inline

C++17 insert_or_assign function assigns the element to the mapped_type if the key exist in the container Otherwise a new value is inserted into the container

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
AZ_FORCE_INLINE mapped_type& AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >::operator[] ( const key_type &  key)
inline

Look up operator if element doesn't exists inserts a new one with (key,mapped_type()).

template<class Key, class MappedType, class Hasher, class EqualKey, class Allocator>
template<typename... Args>
pair_iter_bool AZStd::unordered_map< Key, MappedType, Hasher, EqualKey, Allocator >::try_emplace ( const key_type &  key,
Args &&...  arguments 
)
inline

C++17 try_emplace function that does nothing to the arguments if the key exist in the container, otherwise it constructs the value type as if invoking value_type(AZStd::piecewise_construct, AZStd::forward_as_tuple(AZStd::forward<KeyType>(key)), AZStd::forward_as_tuple(AZStd::forward<Args>(args)...))


The documentation for this class was generated from the following files: