A sparse vector keeping objects at a stable memory location. More...
#include <ArenaMap.h>
Classes | |
| struct | ArenaMapIterator |
Public Types | |
| using | Key = ArenaMapKey<T> |
| using | Gen = typename Key::Generation |
| using | ConstIterator = ArenaMapIterator<const ArenaMap> |
| using | Iterator = ArenaMapIterator<ArenaMap> |
Public Member Functions | |
| ArenaMap (Globals::Type globalsType=Globals::Global) | |
| ArenaMap (const ArenaMap &other) | |
| ArenaMap (ArenaMap &&other) | |
| ArenaMap & | operator= (const ArenaMap &other) |
| ArenaMap & | operator= (ArenaMap &&other) |
| uint32_t | getNumAllocated () const |
| Get the maximum number of objects that can be stored in this map. | |
| ConstIterator | cbegin () const |
| ConstIterator | cend () const |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| Iterator | begin () |
| Iterator | end () |
| void | clear () |
| size_t | size () const |
| Get the number of used slots in the arena. | |
| size_t | capacity () const |
| Get the total number slots in the arena. | |
| bool | isFull () const |
| Returns true if size() == capacity(), that means the arena is full. | |
| bool | resize (size_t newSize) |
| Changes the size of the arena. | |
| template<typename Value > | |
| Key | insert (const Value &object) |
| Key | allocate () |
| template<typename Value > | |
| Key | insert (Value &&object) |
| bool | containsKey (Key key) const |
| template<typename ComparableToValue > | |
| bool | containsValue (const ComparableToValue &value, Key *optionalKey=nullptr) const |
| bool | remove (Key key) |
| T * | get (Key key) |
| const T * | get (Key key) const |
A sparse vector keeping objects at a stable memory location.
| T | Type of items kept in this Arena |
SC::ArenaMap is a container used to keep objects memory location stable.
Internally it hold sparse objects inside of a SC::Vector and for this reason it can only be SC::ArenaMap::resize-d when it's empty.
Objects can be inserted up to the SC::ArenaMap::size and insertion returns handle keys allowing to retrieve the inserted object in constant time.
|
inlinenodiscard |
Get the total number slots in the arena.
|
inline |
Get the maximum number of objects that can be stored in this map.
|
inlinenodiscard |
Returns true if size() == capacity(), that means the arena is full.
|
inlinenodiscard |
Changes the size of the arena.
| newSize | The new wanted number of elements to be stored in the arena |
true if resize succeeded
|
inlinenodiscard |
Get the number of used slots in the arena.