Nugget
Public Types | Public Member Functions | List of all members
eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode > Class Template Reference

#include <hash_set.h>

Inheritance diagram for eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >:
Inheritance graph
[legend]
Collaboration diagram for eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >:
Collaboration graph
[legend]

Public Types

typedef hashtable< Value, Value, Allocator, eastl::use_self< Value >, Predicate, Hash, mod_range_hashing, default_ranged_hash, prime_rehash_policy, bCacheHashCode, false, true > base_type
 
typedef hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode > this_type
 
typedef base_type::size_type size_type
 
typedef base_type::value_type value_type
 
typedef base_type::allocator_type allocator_type
 
typedef base_type::node_type node_type
 
- Public Types inherited from eastl::hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, false, false, true >
enum  
 
typedef Value key_type
 
typedef Value value_type
 
typedef ExtractKey::result_type mapped_type
 
typedef hash_code_base< Value, Value, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, bCacheHashCode > hash_code_base_type
 
typedef hash_code_base_type::hash_code_t hash_code_t
 
typedef EASTLAllocatorType allocator_type
 
typedef eastl::equal_to< Value > key_equal
 
typedef ptrdiff_t difference_type
 
typedef eastl_size_t size_type
 
typedef value_type & reference
 
typedef const value_type & const_reference
 
typedef node_iterator< value_type, !bMutableIterators, bCacheHashCode > local_iterator
 
typedef node_iterator< value_type, true, bCacheHashCode > const_local_iterator
 
typedef hashtable_iterator< value_type, !bMutableIterators, bCacheHashCode > iterator
 
typedef hashtable_iterator< value_type, true, bCacheHashCode > const_iterator
 
typedef hash_node< value_type, bCacheHashCode > node_type
 
typedef type_select< bUniqueKeys, eastl::pair< iterator, bool >, iterator >::type insert_return_type
 
typedef hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, bCacheHashCode, bMutableIterators, bUniqueKeys > this_type
 
typedef prime_rehash_policy rehash_policy_type
 
typedef eastl::use_self< Value > extract_key_type
 
typedef eastl::hash< Value > h1_type
 
typedef mod_range_hashing h2_type
 
typedef default_ranged_hash h_type
 
typedef integral_constant< bool, bUniqueKeys > has_unique_keys_type
 

Public Member Functions

 hash_set (const allocator_type &allocator=EASTL_HASH_SET_DEFAULT_ALLOCATOR)
 
 hash_set (size_type nBucketCount, const Hash &hashFunction=Hash(), const Predicate &predicate=Predicate(), const allocator_type &allocator=EASTL_HASH_SET_DEFAULT_ALLOCATOR)
 
 hash_set (const this_type &x)
 
 hash_set (this_type &&x)
 
 hash_set (this_type &&x, const allocator_type &allocator)
 
 hash_set (std::initializer_list< value_type > ilist, size_type nBucketCount=0, const Hash &hashFunction=Hash(), const Predicate &predicate=Predicate(), const allocator_type &allocator=EASTL_HASH_SET_DEFAULT_ALLOCATOR)
 
template<typename FowardIterator >
 hash_set (FowardIterator first, FowardIterator last, size_type nBucketCount=0, const Hash &hashFunction=Hash(), const Predicate &predicate=Predicate(), const allocator_type &allocator=EASTL_HASH_SET_DEFAULT_ALLOCATOR)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (std::initializer_list< value_type > ilist)
 
this_typeoperator= (this_type &&x)
 
- Public Member Functions inherited from eastl::hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, false, false, true >
 hashtable (size_type nBucketCount, const eastl::hash< Value > &, const mod_range_hashing &, const default_ranged_hash &, const eastl::equal_to< Value > &, const eastl::use_self< Value > &, const allocator_type &allocator=EASTL_HASHTABLE_DEFAULT_ALLOCATOR)
 
 hashtable (FowardIterator first, FowardIterator last, size_type nBucketCount, const eastl::hash< Value > &, const mod_range_hashing &, const default_ranged_hash &, const eastl::equal_to< Value > &, const eastl::use_self< Value > &, const allocator_type &allocator=EASTL_HASHTABLE_DEFAULT_ALLOCATOR)
 
 hashtable (const hashtable &x)
 
 hashtable (this_type &&x)
 
 hashtable (this_type &&x, const allocator_type &allocator)
 
 hashtable (FowardIterator first, FowardIterator last, size_type nBucketCount, const eastl::hash< Value > &h1, const mod_range_hashing &h2, const default_ranged_hash &h, const Eq &eq, const EK &ek, const allocator_type &allocator)
 
const allocator_type & get_allocator () const EA_NOEXCEPT
 
allocator_type & get_allocator () EA_NOEXCEPT
 
void set_allocator (const allocator_type &allocator)
 
this_typeoperator= (const this_type &x)
 
this_typeoperator= (std::initializer_list< value_type > ilist)
 
this_typeoperator= (this_type &&x)
 
void swap (this_type &x)
 
iterator begin () EA_NOEXCEPT
 
const_iterator begin () const EA_NOEXCEPT
 
local_iterator begin (size_type n) EA_NOEXCEPT
 
const_local_iterator begin (size_type n) const EA_NOEXCEPT
 
const_iterator cbegin () const EA_NOEXCEPT
 
const_local_iterator cbegin (size_type n) const EA_NOEXCEPT
 
iterator end () EA_NOEXCEPT
 
const_iterator end () const EA_NOEXCEPT
 
local_iterator end (size_type) EA_NOEXCEPT
 
const_local_iterator end (size_type) const EA_NOEXCEPT
 
const_iterator cend () const EA_NOEXCEPT
 
const_local_iterator cend (size_type) const EA_NOEXCEPT
 
bool empty () const EA_NOEXCEPT
 
size_type size () const EA_NOEXCEPT
 
size_type bucket_count () const EA_NOEXCEPT
 
size_type bucket_size (size_type n) const EA_NOEXCEPT
 
float load_factor () const EA_NOEXCEPT
 
const rehash_policy_typerehash_policy () const EA_NOEXCEPT
 
void rehash_policy (const rehash_policy_type &rehashPolicy)
 
insert_return_type emplace (Args &&... args)
 
iterator emplace_hint (const_iterator position, Args &&... args)
 
insert_return_type try_emplace (const key_type &k, Args &&... args)
 
insert_return_type try_emplace (key_type &&k, Args &&... args)
 
iterator try_emplace (const_iterator position, const key_type &k, Args &&... args)
 
iterator try_emplace (const_iterator position, key_type &&k, Args &&... args)
 
insert_return_type insert (const value_type &value)
 
insert_return_type insert (value_type &&otherValue)
 
iterator insert (const_iterator hint, const value_type &value)
 
iterator insert (const_iterator hint, value_type &&value)
 
void insert (std::initializer_list< value_type > ilist)
 
void insert (InputIterator first, InputIterator last)
 
insert_return_type insert (P &&otherValue)
 
insert_return_type insert (hash_code_t c, node_type *pNodeNew, P &&otherValue)
 
insert_return_type insert (hash_code_t c, node_type *pNodeNew, const value_type &value)
 
eastl::pair< iterator, bool > insert_or_assign (const key_type &k, M &&obj)
 
eastl::pair< iterator, bool > insert_or_assign (key_type &&k, M &&obj)
 
iterator insert_or_assign (const_iterator hint, const key_type &k, M &&obj)
 
iterator insert_or_assign (const_iterator hint, key_type &&k, M &&obj)
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > insert_or_assign (const key_type &k, M &&obj)
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > insert_or_assign (key_type &&k, M &&obj)
 
node_typeallocate_uninitialized_node ()
 
void free_uninitialized_node (node_type *pNode)
 
iterator erase (const_iterator position)
 
iterator erase (const_iterator first, const_iterator last)
 
size_type erase (const key_type &k)
 
void clear ()
 
void clear (bool clearBuckets)
 
void reset_lose_memory () EA_NOEXCEPT
 
void rehash (size_type nBucketCount)
 
void reserve (size_type nElementCount)
 
iterator find (const key_type &key)
 
const_iterator find (const key_type &key) const
 
iterator find_as (const U &u, UHash uhash, BinaryPredicate predicate)
 
const_iterator find_as (const U &u, UHash uhash, BinaryPredicate predicate) const
 
iterator find_as (const U &u)
 
const_iterator find_as (const U &u) const
 
 ENABLE_IF_HASHCODE_EASTLSIZET (HashCodeT, iterator) find_by_hash(HashCodeT c)
 
 ENABLE_IF_HASHCODE_EASTLSIZET (HashCodeT, const_iterator) find_by_hash(HashCodeT c) const
 
iterator find_by_hash (const key_type &k, hash_code_t c)
 
const_iterator find_by_hash (const key_type &k, hash_code_t c) const
 
eastl::pair< iterator, iteratorfind_range_by_hash (hash_code_t c)
 
eastl::pair< const_iterator, const_iteratorfind_range_by_hash (hash_code_t c) const
 
size_type count (const key_type &k) const EA_NOEXCEPT
 
eastl::pair< iterator, iteratorequal_range (const key_type &k)
 
eastl::pair< const_iterator, const_iteratorequal_range (const key_type &k) const
 
bool validate () const
 
int validate_iterator (const_iterator i) const
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > DoInsertValue (BoolConstantT, Args &&... args)
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > DoInsertValue (BoolConstantT, value_type &&value, ENABLE_IF_TRUETYPE(BoolConstantT))
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > DoInsertValue (BoolConstantT, const value_type &value, ENABLE_IF_TRUETYPE(BoolConstantT))
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, value_type &&value, ENABLE_IF_TRUETYPE(BoolConstantT))
 
eastl::pair< typename hashtable< K, V, A, EK, Eq, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, RP, bC, bM, bU >::iterator, bool > DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, const value_type &value, ENABLE_IF_TRUETYPE(BoolConstantT))
 

Additional Inherited Members

- Static Public Attributes inherited from eastl::hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, false, false, true >
static const bool kCacheHashCode
 
- Protected Member Functions inherited from eastl::hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, false, false, true >
iterator DoGetResultIterator (BoolConstantT, const insert_return_type &irt, ENABLE_IF_TRUETYPE(BoolConstantT)=nullptr) const EA_NOEXCEPT
 
iterator DoGetResultIterator (BoolConstantT, const insert_return_type &irt, DISABLE_IF_TRUETYPE(BoolConstantT)=nullptr) const EA_NOEXCEPT
 
node_typeDoAllocateNodeFromKey (const key_type &key)
 
node_typeDoAllocateNodeFromKey (key_type &&key)
 
void DoFreeNode (node_type *pNode)
 
void DoFreeNodes (node_type **pBucketArray, size_type)
 
node_type ** DoAllocateBuckets (size_type n)
 
void DoFreeBuckets (node_type **pBucketArray, size_type n)
 
eastl::pair< iterator, bool > DoInsertValue (BoolConstantT, Args &&... args)
 
iterator DoInsertValue (BoolConstantT, Args &&... args)
 
eastl::pair< iterator, bool > DoInsertValue (BoolConstantT, value_type &&value, ENABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
iterator DoInsertValue (BoolConstantT, value_type &&value, DISABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
eastl::pair< iterator, bool > DoInsertValue (BoolConstantT, const value_type &value, ENABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
iterator DoInsertValue (BoolConstantT, const value_type &value, DISABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
eastl::pair< iterator, bool > DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, value_type &&value, ENABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
iterator DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, value_type &&value, DISABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
eastl::pair< iterator, bool > DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, const value_type &value, ENABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
iterator DoInsertValueExtra (BoolConstantT, const key_type &k, hash_code_t c, node_type *pNodeNew, const value_type &value, DISABLE_IF_TRUETYPE(BoolConstantT)=nullptr)
 
node_typeDoAllocateNode (Args &&... args)
 
node_typeDoAllocateNode (value_type &&value)
 
node_typeDoAllocateNode (const value_type &value)
 
eastl::pair< iterator, bool > DoInsertKey (true_type, const key_type &key, hash_code_t c)
 
iterator DoInsertKey (false_type, const key_type &key, hash_code_t c)
 
eastl::pair< iterator, bool > DoInsertKey (true_type, key_type &&key, hash_code_t c)
 
iterator DoInsertKey (false_type, key_type &&key, hash_code_t c)
 
eastl::pair< iterator, bool > DoInsertKey (true_type, const key_type &key)
 
iterator DoInsertKey (false_type, const key_type &key)
 
eastl::pair< iterator, bool > DoInsertKey (true_type, key_type &&key)
 
iterator DoInsertKey (false_type, key_type &&key)
 
void DoRehash (size_type nBucketCount)
 
node_typeDoFindNode (node_type *pNode, const key_type &k, hash_code_t c) const
 
 ENABLE_IF_HAS_HASHCODE (T, node_type) DoFindNode(T *pNode
 
node_typeDoFindNodeT (node_type *pNode, const U &u, BinaryPredicate predicate) const
 
- Protected Attributes inherited from eastl::hashtable< Value, Value, EASTLAllocatorType, eastl::use_self< Value >, eastl::equal_to< Value >, eastl::hash< Value >, mod_range_hashing, default_ranged_hash, prime_rehash_policy, false, false, true >
node_type ** mpBucketArray
 
size_type mnBucketCount
 
size_type mnElementCount
 
prime_rehash_policy mRehashPolicy
 
allocator_type mAllocator
 
hash_code_t c const
 

Detailed Description

template<typename Value, typename Hash = eastl::hash<Value>, typename Predicate = eastl::equal_to<Value>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
class eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >

hash_set

Implements a hash_set, which is a hashed unique-item container. Lookups are O(1) (that is, they are fast) but the container is not sorted. Note that lookups are only O(1) if the hash table is well-distributed (non-colliding). The lookup approaches O(n) behavior as the table becomes increasingly poorly distributed.

set_max_load_factor If you want to make a hashtable never increase its bucket usage, call set_max_load_factor with a very high value such as 100000.f.

bCacheHashCode We provide the boolean bCacheHashCode template parameter in order to allow the storing of the hash code of the key within the map. When this option is disabled, the rehashing of the table will call the hash function on the key. Setting bCacheHashCode to true is useful for cases whereby the calculation of the hash value for a contained object is very expensive.

find_as In order to support the ability to have a hashtable of strings but be able to do efficiently lookups via char pointers (i.e. so they aren't converted to string objects), we provide the find_as function. This function allows you to do a find with a key of a type other than the hashtable key type.

Example find_as usage: hash_set<string> hashSet; i = hashSet.find_as("hello"); // Use default hash and compare.

Example find_as usage (namespaces omitted for brevity): hash_set<string> hashSet; i = hashSet.find_as("hello", hash<char*>(), equal_to_2<string, char*>());

Constructor & Destructor Documentation

◆ hash_set() [1/4]

template<typename Value , typename Hash = eastl::hash<Value>, typename Predicate = eastl::equal_to<Value>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >::hash_set ( const allocator_type &  allocator = EASTL_HASH_SET_DEFAULT_ALLOCATOR)
inlineexplicit

hash_set

Default constructor.

◆ hash_set() [2/4]

template<typename Value , typename Hash = eastl::hash<Value>, typename Predicate = eastl::equal_to<Value>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >::hash_set ( size_type  nBucketCount,
const Hash &  hashFunction = Hash(),
const Predicate &  predicate = Predicate(),
const allocator_type &  allocator = EASTL_HASH_SET_DEFAULT_ALLOCATOR 
)
inlineexplicit

hash_set

Constructor which creates an empty container, but start with nBucketCount buckets. We default to a small nBucketCount value, though the user really should manually specify an appropriate value in order to prevent memory from being reallocated.

◆ hash_set() [3/4]

template<typename Value , typename Hash = eastl::hash<Value>, typename Predicate = eastl::equal_to<Value>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >::hash_set ( std::initializer_list< value_type >  ilist,
size_type  nBucketCount = 0,
const Hash &  hashFunction = Hash(),
const Predicate &  predicate = Predicate(),
const allocator_type &  allocator = EASTL_HASH_SET_DEFAULT_ALLOCATOR 
)
inline

hash_set

initializer_list-based constructor. Allows for initializing with brace values (e.g. hash_set<int> hs = { 3, 4, 5, }; )

◆ hash_set() [4/4]

template<typename Value , typename Hash = eastl::hash<Value>, typename Predicate = eastl::equal_to<Value>, typename Allocator = EASTLAllocatorType, bool bCacheHashCode = false>
template<typename FowardIterator >
eastl::hash_set< Value, Hash, Predicate, Allocator, bCacheHashCode >::hash_set ( FowardIterator  first,
FowardIterator  last,
size_type  nBucketCount = 0,
const Hash &  hashFunction = Hash(),
const Predicate &  predicate = Predicate(),
const allocator_type &  allocator = EASTL_HASH_SET_DEFAULT_ALLOCATOR 
)
inline

hash_set

An input bucket count of <= 1 causes the bucket count to be equal to the number of elements in the input range.


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