![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
An allocator of objects referenced by an index. More...
#include <gf/BlockAllocator.h>
Public Member Functions | |
BlockAllocator () | |
Default constructor. More... | |
std::size_t | allocate () |
Allocate an object. More... | |
void | dispose (std::size_t index) |
Deallocate the object at the given index. More... | |
T & | operator[] (std::size_t index) |
Access the object at a given index. More... | |
const T & | operator[] (std::size_t index) const |
Access the object at a given index. More... | |
void | clear () |
Remove all objects at once. More... | |
std::size_t | getAllocated () const |
Get the number of allocated objects. More... | |
An allocator of objects referenced by an index.
|
inline |
Default constructor.
|
inline |
Allocate an object.
|
inline |
Remove all objects at once.
|
inline |
Deallocate the object at the given index.
After this function call, the index is not valid anymore.
index | A valid index |
|
inline |
Get the number of allocated objects.
|
inline |
Access the object at a given index.
index | A valid index |
|
inline |
Access the object at a given index.
index | A valid index |