|
SleakEngine 1.0.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 (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 |
| Looks up key and writes its value into outValue; returns false if not found. | |
| size_t | getCapacity () const |
| size_t | getSize () const |
| void | insert (const Key &key, const Value &value) |
| Inserts or updates the value for key, resizing first if over the load factor. | |
| 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 31 of file HashTable.hpp.
|
inline |
Definition at line 84 of file HashTable.hpp.
|
inline |
Definition at line 90 of file HashTable.hpp.
|
inline |
Drops every entry and reallocates the table at its current capacity.
Definition at line 172 of file HashTable.hpp.
|
inline |
True if key currently has a live entry.
Definition at line 157 of file HashTable.hpp.
|
inline |
Looks up key and writes its value into outValue; returns false if not found.
Definition at line 141 of file HashTable.hpp.
|
inline |
Definition at line 180 of file HashTable.hpp.
|
inline |
Definition at line 179 of file HashTable.hpp.
|
inline |
Inserts or updates the value for key, resizing first if over the load factor.
Definition at line 96 of file HashTable.hpp.
|
inline |
Tombstones the entry for key; returns false if it wasn't present.
Definition at line 124 of file HashTable.hpp.