|
MxEngine
|
#include <VectorPool.h>
Classes | |
| class | PoolIterator |
Public Types | |
| using | Allocator = PoolAllocator< T > |
| using | Block = typename Allocator::Block |
Public Member Functions | |
| VectorPool ()=default | |
| VectorPool (size_t count) | |
| void | Resize (size_t count) |
| size_t | Allocated () const |
| size_t | Capacity () const |
| T & | operator[] (size_t index) |
| const T & | operator[] (size_t index) const |
| void | Clear () |
| bool | IsAllocated (size_t index) |
| void | Deallocate (size_t index) |
| void | Deallocate (const PoolIterator &it) |
| template<typename... Args> | |
| size_t | Allocate (Args &&... args) |
| size_t | IndexOf (const T &obj) |
| PoolIterator | begin () |
| const PoolIterator | begin () const |
| PoolIterator | end () |
| const PoolIterator | end () const |
VectorPool is an object Pool class which is used for fast allocations/deallocations of objects of type T objects are accessed by index in array and references should not be stored (as any allocation can potentially invalidate them) to check if object is allocated before access, use IsAllocated(index). To allocate use Allocate(args), to deallocate - Deallocate(index)
|
default |
constructs default vector Pool with zero capacity (no memory request to inner container)
|
inline |
constructs vector Pool with count elements as capacity number of preallocated elements (not constructed)
|
inline |
constructs element in vector Pool. If it has not enough space - Resize(bigger size) is called
| args | arguments for element constructor |
|
inline |
gets how many elements are in use (constructed)
|
inline |
begin of vector Pool container
|
inline |
begin of vector Pool container
|
inline |
gets total number of elements in the container
|
inline |
clears container. All constructed elements are destroyed
|
inline |
destroys element in vector Pool
| index | index of element to destroy |
|
inline |
end of vector Pool container
|
inline |
end of vector Pool container
|
inline |
retrieves index of element in vector Pool by reference
| obj | element of vector Pool |
|
inline |
checks if element is constructed
| index | index of element in vector Pool |
|
inline |
reference getter for element. Element must be contructed before call
|
inline |
const reference getter for element. Element must be contructed before call
|
inline |
increases container size. If new count is less or equal than current, request is ignored
| new | number of preallocated elements in container (not constructed) |
1.8.12