|
SleakEngine 0.1.0
C++23 multi-backend game engine
|
Implements a hash table (or map) for efficient key-value storage and retrieval. More...
#include <HashTable.hpp>
Public Member Functions | |
| HashTable (const HashTable &other) | |
| Deep-copies other's slots, including its capacity and load factor. | |
| HashTable (size_t initCapacity=DEFAULT_CAPACITY, float loadFactor=DEFAULT_LOAD_FACTOR) | |
| ~HashTable () | |
| void | clear () |
| Drops every entry and reallocates the table at its current capacity. | |
| bool | contains (const Key &key) const |
| True if key currently has a live entry. | |
| bool | get (const Key &key, Value &outValue) const |
| size_t | getCapacity () const |
| size_t | getSize () const |
| void | insert (const Key &key, const Value &value) |
| HashTable & | operator= (const HashTable &other) |
| Replaces this table with a deep copy of other. | |
| bool | remove (const Key &key) |
| Tombstones the entry for key; returns false if it wasn't present. | |
Implements a hash table (or map) for efficient key-value storage and retrieval.
The HashTable class provides fast access to values based on their associated keys. It is suitable for scenarios where you need to quickly look up data using unique identifiers. Use this class when you need to store and retrieve data based on keys, such as symbol tables, dictionaries, or caching systems.
Example Use Cases:
Implementation Details:
Definition at line 34 of file HashTable.hpp.
|
inline |
Definition at line 106 of file HashTable.hpp.
|
inline |
Deep-copies other's slots, including its capacity and load factor.
Definition at line 118 of file HashTable.hpp.
|
inline |
Definition at line 142 of file HashTable.hpp.
|
inline |
Drops every entry and reallocates the table at its current capacity.
Definition at line 201 of file HashTable.hpp.
|
inline |
True if key currently has a live entry.
Definition at line 198 of file HashTable.hpp.
|
inline |
Looks up key and writes its value into outValue; returns false if not found.
Definition at line 188 of file HashTable.hpp.
|
inline |
Definition at line 210 of file HashTable.hpp.
|
inline |
Definition at line 209 of file HashTable.hpp.
|
inline |
Inserts or updates the value for key, resizing first if over the load factor.
Definition at line 146 of file HashTable.hpp.
|
inline |
Replaces this table with a deep copy of other.
Definition at line 130 of file HashTable.hpp.
|
inline |
Tombstones the entry for key; returns false if it wasn't present.
Definition at line 173 of file HashTable.hpp.