A hash map from ID to a small value, for indexes rebuilt or pruned every frame: open addressing in one array, so adding allocates nothing once the map has grown to the frame's size, and Clear keeps that room.
More...
#include <gui_core/gui_id_map.h>
|
| T * | Find (ID key) |
| | The value held for key, or null.
|
| const T * | Find (ID key) const |
| std::pair< T *, bool > | TryEmplace (ID key, const T &value) |
| | Adds key with value unless the key is there already.
|
| void | Clear () |
| | Empties the map, keeping its room, unless that is far more than this fill needed: after one huge frame, later small ones don't pay to clear (or hold) all of it.
|
| template<typename Visit> |
| void | ForEach (Visit &&visit) |
| | Calls visit(key, value) for each entry, in no particular order.
|
| template<typename Erase> |
| void | EraseIf (Erase &&erase) |
| | Drops each entry erase(key, value) is true for.
|
| size_t | Size () const |
| size_t | Capacity () const |
template<typename T>
class tachyon::IDMap< T >
A hash map from ID to a small value, for indexes rebuilt or pruned every frame: open addressing in one array, so adding allocates nothing once the map has grown to the frame's size, and Clear keeps that room.
Entries go only all at once (Clear) or by a sweep (EraseIf). ID::Invalid() marks a free slot, so it can't be a key.
◆ Find() [1/2]
The value held for key, or null.
◆ Find() [2/2]
◆ TryEmplace()
template<typename T>
| std::pair< T *, bool > tachyon::IDMap< T >::TryEmplace |
( |
ID | key, |
|
|
const T & | value ) |
|
inline |
Adds key with value unless the key is there already.
Returns the value held for the key and whether it was added; {null, false} for ID::Invalid(), which marks a free slot and can't be a key.
◆ Clear()
Empties the map, keeping its room, unless that is far more than this fill needed: after one huge frame, later small ones don't pay to clear (or hold) all of it.
◆ ForEach()
template<typename T>
template<typename Visit>
Calls visit(key, value) for each entry, in no particular order.
◆ EraseIf()
template<typename T>
template<typename Erase>
Drops each entry erase(key, value) is true for.
Once over the table: the entries kept are set aside and added again, so the probe chains stay whole.
◆ Size()
◆ Capacity()
The documentation for this class was generated from the following file: