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

#include <unordered_set.h>

Inherits AZStd::hash_table< Traits >.

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 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 node_type = set_node_handle< set_node_traits< value_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 Types inherited from AZStd::hash_table< Traits >
typedef Traits traits_type
 
typedef Traits::key_type key_type
 
typedef Traits::key_equal key_equal
 
typedef Traits::hasher hasher
 
typedef Traits::allocator_type allocator_type
 
typedef storage_type::list_type list_type
 
typedef list_type::size_type size_type
 
typedef list_type::difference_type difference_type
 
typedef list_type::pointer pointer
 
typedef list_type::const_pointer const_pointer
 
typedef list_type::reference reference
 
typedef list_type::const_reference const_reference
 
typedef list_type::iterator iterator
 
typedef list_type::const_iterator const_iterator
 
typedef list_type::reverse_iterator reverse_iterator
 
typedef list_type::const_reverse_iterator const_reverse_iterator
 
typedef list_type::value_type value_type
 
typedef iterator local_iterator
 
typedef const_iterator const_local_iterator
 
typedef storage_type::vector_value_type vector_value_type
 
typedef storage_type::vector_type vector_type
 
typedef AZStd::pair< iterator, bool > pair_iter_bool
 
typedef AZStd::pair< iterator, iteratorpair_iter_iter
 
typedef AZStd::pair< const_iterator, const_iteratorpair_citer_citer
 
typedef list_type::node_type list_node_type
 
typedef vector_type::node_type vector_node_type
 
typedef hash_node_destructor< allocator_type, list_node_type > node_deleter
 

Public Member Functions

 unordered_set (size_type numBuckets, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &alloc=allocator_type())
 
template<class Iterator >
 unordered_set (Iterator first, Iterator last, size_type numBuckets={}, 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_set (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_set (const unordered_set &rhs)
 
 unordered_set (unordered_set &&rhs)
 
 unordered_set (const allocator_type &alloc)
 
 unordered_set (const unordered_set &rhs, const type_identity_t< allocator_type > &alloc)
 
 unordered_set (unordered_set &&rhs, const type_identity_t< allocator_type > &alloc)
 
 unordered_set (const initializer_list< value_type > &list, size_type numBuckets={}, const hasher &hash=hasher(), const key_equal &keyEqual=key_equal(), const allocator_type &alloc=allocator_type())
 
 unordered_set (size_type numBucketsHint, const allocator_type &alloc)
 
 unordered_set (size_type numBucketsHint, const hasher &hash, const allocator_type &alloc)
 
template<class InputIterator >
 unordered_set (InputIterator f, InputIterator l, size_type n, const allocator_type &a)
 
template<class InputIterator >
 unordered_set (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_set (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_set (from_range_t, R &&rg, size_type n, const hasher &hf, const allocator_type &a)
 
 unordered_set (initializer_list< value_type > il, size_type n, const allocator_type &a)
 
 unordered_set (initializer_list< value_type > il, size_type n, const hasher &hf, const allocator_type &a)
 
 unordered_set (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)
 
this_typeoperator= (const this_type &rhs)
 
insert_return_type insert (node_type &&nodeHandle)
 
iterator insert (const_iterator hint, node_type &&nodeHandle)
 
node_type extract (const key_type &key)
 
node_type extract (const_iterator it)
 
AZ_FORCE_INLINE pair_iter_bool insert (const value_type &value)
 
AZ_FORCE_INLINE iterator insert (const_iterator, const value_type &value)
 
AZ_FORCE_INLINE pair_iter_bool insert (value_type &&value)
 
AZ_FORCE_INLINE iterator insert (const_iterator, value_type &&value)
 
AZ_FORCE_INLINE void insert (std::initializer_list< value_type > list)
 
template<class Iterator >
auto insert (Iterator first, Iterator last) -> enable_if_t< input_iterator< Iterator > &&!is_convertible_v< Iterator, size_type > >
 
template<class R >
auto insert_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type > >
 
- Public Member Functions inherited from AZStd::hash_table< Traits >
AZ_FORCE_INLINE hash_table (const hasher &hash, const key_equal &keyEqual, const allocator_type &alloc=allocator_type())
 
AZ_FORCE_INLINE hash_table (const value_type *first, const value_type *last, const hasher &hash, const key_equal &keyEqual, const allocator_type &alloc)
 
 hash_table (const hash_table &rhs)
 
 hash_table (const hash_table &rhs, const type_identity_t< allocator_type > &alloc)
 
 hash_table (hash_table &&rhs)
 
 hash_table (hash_table &&rhs, const type_identity_t< allocator_type > &alloc)
 
this_typeoperator= (this_type &&rhs)
 
AZ_FORCE_INLINE this_typeoperator= (const this_type &rhs)
 
AZ_FORCE_INLINE iterator begin ()
 
AZ_FORCE_INLINE const_iterator begin () const
 
AZ_FORCE_INLINE iterator end ()
 
AZ_FORCE_INLINE const_iterator end () const
 
AZ_FORCE_INLINE local_iterator begin (size_type bucket)
 
AZ_FORCE_INLINE const_local_iterator begin (size_type bucket) const
 
AZ_FORCE_INLINE local_iterator end (size_type bucket)
 
AZ_FORCE_INLINE const_local_iterator end (size_type bucket) const
 
AZ_FORCE_INLINE reverse_iterator rbegin ()
 
AZ_FORCE_INLINE const_reverse_iterator rbegin () const
 
AZ_FORCE_INLINE reverse_iterator rend ()
 
AZ_FORCE_INLINE const_reverse_iterator rend () const
 
AZ_FORCE_INLINE size_type size () const
 
AZ_FORCE_INLINE size_type max_size () const
 
AZ_FORCE_INLINE bool empty () const
 
AZ_FORCE_INLINE key_equal key_eq () const
 
AZ_FORCE_INLINE hasher get_hasher () const
 
AZ_FORCE_INLINE size_type bucket_count () const
 
AZ_FORCE_INLINE size_type max_bucket_count () const
 
AZ_FORCE_INLINE size_type bucket (const key_type &keyValue) const
 
AZ_INLINE size_type bucket_size (size_type bucket) const
 
AZ_FORCE_INLINE float load_factor () const
 
AZ_FORCE_INLINE float max_load_factor () const
 
AZ_FORCE_INLINE void max_load_factor (float newMaxLoadFactor)
 
AZ_FORCE_INLINE pair_iter_bool insert (const value_type &value)
 
AZ_FORCE_INLINE iterator insert (const_iterator, const value_type &value)
 
AZ_FORCE_INLINE pair_iter_bool insert (value_type &&value)
 
AZ_FORCE_INLINE iterator insert (const_iterator, value_type &&value)
 
template<typename... Args>
AZ_FORCE_INLINE pair_iter_bool emplace (Args &&... arguments)
 
AZ_FORCE_INLINE void insert (std::initializer_list< value_type > list)
 
template<class Iterator >
auto insert (Iterator first, Iterator last) -> enable_if_t< input_iterator< Iterator > &&!is_convertible_v< Iterator, size_type > >
 
template<class R >
auto insert_range (R &&rg) -> enable_if_t< Internal::container_compatible_range< R, value_type > >
 
template<class InsertReturnType , class NodeHandle >
InsertReturnType node_handle_insert (NodeHandle &&nodeHandle)
 
template<class NodeHandle >
auto node_handle_insert (const_iterator hint, NodeHandle &&nodeHandle) -> iterator
 
template<class NodeHandle >
NodeHandle node_handle_extract (const key_type &key)
 
template<class NodeHandle >
NodeHandle node_handle_extract (const_iterator it)
 
AZ_FORCE_INLINE void reserve (size_type numBucketsMin)
 
AZ_FORCE_INLINE void rehash (size_type numBucketsMin)
 
iterator erase (const_iterator erasePos)
 
size_type erase (const key_type &keyValue)
 
iterator erase (const_iterator first, const_iterator last)
 
AZ_FORCE_INLINE void clear ()
 
template<class ComparableToKey >
auto find (const ComparableToKey &key) -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, iterator >
 
template<class ComparableToKey >
auto find (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, const_iterator >
 
template<class ComparableToKey >
auto contains (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, bool >
 
template<class ComparableToKey >
auto count (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, size_type >
 
template<class ComparableToKey >
auto lower_bound (const ComparableToKey &key) -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, iterator >
 
template<class ComparableToKey >
auto lower_bound (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, const_iterator >
 
template<class ComparableToKey >
auto upper_bound (const ComparableToKey &key) -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, iterator >
 
template<class ComparableToKey >
auto upper_bound (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, const_iterator >
 
template<class ComparableToKey >
auto equal_range (const ComparableToKey &key) -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, AZStd::pair< iterator, iterator > >
 
template<class ComparableToKey >
auto equal_range (const ComparableToKey &key) const -> enable_if_t<(Internal::is_transparent< key_equal, ComparableToKey >::value &&Internal::is_transparent< hasher, ComparableToKey >::value)||AZStd::is_convertible_v< ComparableToKey, key_type >, AZStd::pair< const_iterator, const_iterator > >
 
AZ_INLINE void swap (this_type &rhs)
 
template<typename ComparableToKey , typename... Args>
auto try_emplace_transparent (ComparableToKey &&key, Args &&... arguments) -> pair_iter_bool
 
template<typename ComparableToKey , typename... Args>
auto try_emplace_transparent (const_iterator, ComparableToKey &&key, Args &&... arguments) -> iterator
 
template<typename ComparableToKey , typename MappedType >
auto insert_or_assign_transparent (ComparableToKey &&key, MappedType &&value) -> pair_iter_bool
 
template<typename ComparableToKey , typename MappedType >
auto insert_or_assign_transparent (const_iterator, ComparableToKey &&key, MappedType &&value) -> iterator
 
AZ_FORCE_INLINE allocator_type & get_allocator ()
 
AZ_FORCE_INLINE const allocator_type & get_allocator () const
 
void set_allocator (const allocator_type &allocator)
 
template<class ComparableToKey , class Hasher , class KeyEqual >
iterator find_as (const ComparableToKey &keyCmp, const Hasher &hash, const KeyEqual &keyEq)
 
template<class ComparableToKey , class Hasher , class KeyEqual >
const_iterator find_as (const ComparableToKey &keyCmp, const Hasher &hash, const KeyEqual &keyEq) const
 
template<class U , class Converter , class Hasher , class KeyEqual >
pair_iter_bool insert_from (const U &userValue, const Converter &convert, const Hasher &hash, const KeyEqual &keyEq)
 
bool validate () const
 
int validate_iterator (const iterator &iter) const
 Validates an iter iterator. Returns a combination of iterator_status_flag.
 
int validate_iterator (const const_iterator &iter) const
 
void leak_and_reset ()
 

Additional Inherited Members

- Protected Member Functions inherited from AZStd::hash_table< Traits >
AZ_FORCE_INLINE size_type bucket_from_hash (const size_type key) const
 
void copy (const this_type &rhs)
 
void assign_rv (this_type &&rhs)
 
template<class ComparableToKey , class KeyEq >
bool find_insert_position (const ComparableToKey &keyCmp, const KeyEq &keyEq, iterator &insertIter, size_type numElements, const true_type &)
 
template<class ComparableToKey , class KeyEq >
bool find_insert_position (const ComparableToKey &keyCmp, const KeyEq &keyEq, iterator &insertIter, size_type numElements, const false_type &)
 
template<typename T >
pair_iter_bool insert_impl (T &&value)
 
template<typename... Args>
pair_iter_bool insert_impl_emplace (Args &&... arguments)
 
template<typename ComparableToKey , typename... Args>
pair_iter_bool try_emplace_transparent (ComparableToKey &&key, Args &&... arguments)
 
template<typename ComparableToKey , typename... Args>
iterator try_emplace_transparent (const_iterator hint, ComparableToKey &&key, Args &&... arguments)
 
template<typename ComparableToKey , typename MappedType >
pair_iter_bool insert_or_assign_transparent (ComparableToKey &&key, MappedType &&value)
 
template<typename ComparableToKey , typename MappedType >
iterator insert_or_assign_transparent (const_iterator hint, ComparableToKey &&key, MappedType &&value)
 
- Protected Attributes inherited from AZStd::hash_table< Traits >
storage_type m_data
 
key_equal m_keyEqual
 
hasher m_hasher
 

Detailed Description

template<class Key, class Hasher = AZStd::hash<Key>, class EqualKey = AZStd::equal_to<Key>, class Allocator = AZStd::allocator>
class AZStd::unordered_set< Key, Hasher, EqualKey, Allocator >

Unordered set container is complaint with CTR1 (6.2.4.3) This is an associative container, all Keys are unique. insert function will return false, if you try to add key that is in the set. It has the extensions in the hash_table class.

Check the unordered_set AZStdExamples.

Note
By default we don't have reverse iterators for unordered_xxx containers. This saves us 4 bytes per node and it's not used in the majority of cases. Reverse iterators are supported via the last template parameter.

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