Navigation
API > API/Runtime > API/Runtime/uLangCore > API/Runtime/uLangCore/uLang > API/Runtime/uLangCore/uLang/Common > API/Runtime/uLangCore/uLang/Common/Containers
References
| Module | uLangCore |
| Header | /Engine/Source/Runtime/Solaris/uLangCore/Public/uLang/Common/Containers/HashTable.h |
| Include | #include "uLang/Common/Containers/HashTable.h" |
Syntax
template<class KeyType, class KeyValueType, class HashTraits, class AllocatorType, typename... AllocatorArgsType>
class THashTable
Remarks
A Robin-Hood hash table Inspired by https://www.sebastiansylvan.com/post/robin-hood-hashing-should-be-your-default-hash-table-implementation/ and http://codecapsule.com/2013/11/17/robin-hood-hashing-backward-shift-deletion/
Variables
| Type | Name | Description | |
|---|---|---|---|
| AllocatorType | _Allocator | How to allocate the memory This allocator can be 0 in size | |
| SEntry * | _Entries | ||
| uint32_t | _NumEntries | ||
| uint32_t | _NumOccupied |
Constructors
| Type | Name | Description | |
|---|---|---|---|
THashTable
(
AllocatorArgsType&&... AllocatorArgs |
|||
THashTable
(
const THashTable& Other |
|||
THashTable
(
THashTable&& Other |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~THashTable () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Allocate () |
Allocate memory according to currently set _NumEntries. | |
| ULANG_FORCEINLINEIterator< true > | begin () |
||
| ULANG_FORCEINLINEIterator< false > | begin () |
||
| ULANG_FORCEINLINEIterator< true > | cbegin () |
||
| ULANG_FORCEINLINEIterator< true > | cend () |
||
| ULANG_FORCEINLINE uint32_t | ComputeNonZeroHash
(
const KeyType& Key |
Hash values in the table must not be zero. | |
| ULANG_FORCEINLINE bool | Contains
(
const KeyType& Key |
||
| ULANG_FORCEINLINE uint32_t | DesiredPos
(
uint32_t Hash |
Get desired position for an entry given a hash value. | |
| void | Empty () |
||
| ULANG_FORCEINLINEIterator< false > | end () |
||
| ULANG_FORCEINLINEIterator< false > | end () |
||
| ULANG_FORCEINLINE const KeyValueType * | Find
(
const KeyType& Key |
||
| ULANG_FORCEINLINE KeyValueType * | Find
(
const KeyType& Key |
||
| KeyValueType * | FindByPredicate
(
Predicate Pred |
Finds a key-value pair which matches a predicate functor. | |
| const KeyValueType * | FindByPredicate
(
Predicate Pred |
Finds an key-value pair which matches a predicate functor. | |
| KeyValueType & | FindOrInsert
(
KeyValueType&& KeyValue |
||
| void | Grow () |
Double the size of the table. | |
| KeyValueType & | Insert
(
KeyValueType&& KeyValue |
||
| KeyValueType & | Insert
(
const KeyValueType& KeyValue |
||
| uint32_t | InsertInternal
(
uint32_t Hash, |
Create a new entry Use Robin Hood mechanism to rearrange entries to minimize probe distance Returns position of new entry | |
| KeyValueType & | InsertInternal
(
KeyValueType&& KeyValue |
||
| bool | IsEmpty () |
||
| ULANG_FORCEINLINE uint32_t | Lookup
(
const KeyType& Key |
Look up a key, return its index. | |
| ULANG_FORCEINLINE uint32_t | Num () |
||
| ULANG_FORCEINLINE uint32_t | ProbeDistance
(
uint32_t Hash, |
Get probe distance of an entry with given hash and position in entry array. | |
| bool | Remove
(
const KeyType& Key |
||
| void | Swap
(
THashTable& Other |
Operators
| Type | Name | Description | |
|---|---|---|---|
| THashTable & | operator=
(
THashTable Other |
Classes
Constants
| Name | Description |
|---|---|
| MaxLoadFactorDenominator | |
| MaxLoadFactorNumerator | Load factor = what fraction of entries are occupied. |