![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
#include <HashTable.h>
Classes | |
| class | const_iterator |
| Const iterator. More... | |
| class | iterator |
| Non-const iterator. More... | |
Public Types | |
| using | value_type = KeyValue |
| Properties. More... | |
| using | size_type = uint32 |
| using | difference_type = ptrdiff_t |
Public Member Functions | |
| HashTable ()=default | |
| Default constructor. More... | |
| HashTable (const HashTable &inRHS) | |
| Copy constructor. More... | |
| HashTable (HashTable &&ioRHS) noexcept | |
| Move constructor. More... | |
| HashTable & | operator= (const HashTable &inRHS) |
| Assignment operator. More... | |
| HashTable & | operator= (HashTable &&ioRHS) noexcept |
| Move assignment operator. More... | |
| ~HashTable () | |
| Destructor. More... | |
| void | reserve (size_type inMaxSize) |
| Reserve memory for a certain number of elements. More... | |
| void | clear () |
| Destroy the entire hash table. More... | |
| void | ClearAndKeepMemory () |
| Destroy the entire hash table but keeps the memory allocated. More... | |
| iterator | begin () |
| Iterator to first element. More... | |
| iterator | end () |
| Iterator to one beyond last element. More... | |
| const_iterator | begin () const |
| Iterator to first element. More... | |
| const_iterator | end () const |
| Iterator to one beyond last element. More... | |
| const_iterator | cbegin () const |
| Iterator to first element. More... | |
| const_iterator | cend () const |
| Iterator to one beyond last element. More... | |
| size_type | bucket_count () const |
| Number of buckets in the table. More... | |
| constexpr size_type | max_bucket_count () const |
| Max number of buckets that the table can have. More... | |
| bool | empty () const |
| Check if there are no elements in the table. More... | |
| size_type | size () const |
| Number of elements in the table. More... | |
| constexpr size_type | max_size () const |
| Max number of elements that the table can hold. More... | |
| constexpr float | max_load_factor () const |
| Get the max load factor for this table (max number of elements / number of buckets) More... | |
| std::pair< iterator, bool > | insert (const value_type &inValue) |
| Insert a new element, returns iterator and if the element was inserted. More... | |
| const_iterator | find (const Key &inKey) const |
| Find an element, returns iterator to element or end() if not found. More... | |
| void | erase (const const_iterator &inIterator) |
| Erase an element by iterator. More... | |
| size_type | erase (const Key &inKey) |
| Erase an element by key. More... | |
| void | swap (HashTable &ioRHS) noexcept |
| Swap the contents of two hash tables. More... | |
| void | rehash (size_type) |
Protected Member Functions | |
| KeyValue & | GetElement (size_type inIndex) const |
| Get an element by index. More... | |
| template<bool InsertAfterGrow = false> | |
| bool | InsertKey (const Key &inKey, size_type &outIndex) |
Helper class for implementing an UnorderedSet or UnorderedMap Based on CppCon 2017: Matt Kulukundis "Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step" See: https://www.youtube.com/watch?v=ncHmEUmJZf4
| using HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >::difference_type = ptrdiff_t |
| using HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >::size_type = uint32 |
| using HashTable< Key, KeyValue, HashTableDetail, Hash, KeyEqual >::value_type = KeyValue |
Properties.
|
default |
Default constructor.
|
inline |
Copy constructor.
|
inlinenoexcept |
Move constructor.
|
inline |
Destructor.
|
inline |
Iterator to first element.
|
inline |
Iterator to first element.
|
inline |
Number of buckets in the table.
|
inline |
Iterator to first element.
|
inline |
Iterator to one beyond last element.
|
inline |
Destroy the entire hash table.
|
inline |
Destroy the entire hash table but keeps the memory allocated.
|
inline |
Check if there are no elements in the table.
|
inline |
Iterator to one beyond last element.
|
inline |
Iterator to one beyond last element.
|
inline |
Erase an element by iterator.
|
inline |
Erase an element by key.
|
inline |
Find an element, returns iterator to element or end() if not found.
|
inlineprotected |
Get an element by index.
|
inline |
Insert a new element, returns iterator and if the element was inserted.
|
inlineprotected |
Insert a key into the map, returns true if the element was inserted, false if it already existed. outIndex is the index at which the element should be constructed / where it is located.
|
inlineconstexpr |
Max number of buckets that the table can have.
|
inlineconstexpr |
Get the max load factor for this table (max number of elements / number of buckets)
|
inlineconstexpr |
Max number of elements that the table can hold.
|
inline |
Assignment operator.
|
inlinenoexcept |
Move assignment operator.
|
inline |
In place re-hashing of all elements in the table. Removes all cBucketDeleted elements The std version takes a bucket count, but we just re-hash to the same size.
|
inline |
Reserve memory for a certain number of elements.
|
inline |
Number of elements in the table.
|
inlinenoexcept |
Swap the contents of two hash tables.