cObjectPool class
Base classes
- class cObjectPool_
- Stores a pool of objects whose memory can be reused efficiently, without need for heap allocations.
Public functions
- auto Initialize(int numObjects) -> void
- auto Get(cObjectPoolIndex index) -> T*
- Returns the object at the given index.
- auto GetIfNotDeleted(cObjectPoolIndex index) -> T*
- Returns the object at the given index, only if it has not been deleted.
- auto Iterate(Iterator& it) const -> T*
- Advances the iterator and returns the next object, or nullptr if the iterator reached the end.
Function documentation
T* Simulator:: cObjectPool<_1>:: Get(cObjectPoolIndex index)
Returns the object at the given index.
Parameters | |
---|---|
index |
This will return even if the index is not valid or the object is not alive.
T* Simulator:: cObjectPool<_1>:: GetIfNotDeleted(cObjectPoolIndex index)
Returns the object at the given index, only if it has not been deleted.
Parameters | |
---|---|
index | |
Returns | The object, or nullptr if the object was deleted. |