Object pool with indexable properties. More...
#include <playrho/ObjectPool.hpp>
Public Types | |
using | const_reference = typename std::vector< value_type >::const_reference |
Constant reference type alias. | |
using | reference = typename std::vector< value_type >::reference |
Reference type alias. | |
using | size_type = typename std::vector< value_type >::size_type |
Size type. | |
using | value_type = T |
Element type. | |
Public Member Functions | |
template<class... Args> | |
size_type | Allocate (Args &&... args) |
Allocates an entry in the array with the given constructor parameters. More... | |
size_type | Allocate (const value_type ©) |
Allocates an entry in the array with the given instance. More... | |
reference | at (size_type pos) |
Bounds checking indexed array accessor. | |
const_reference | at (size_type pos) const |
Bounds checking indexed array accessor. | |
std::vector< value_type >::const_iterator | begin () const noexcept |
Gets the beginning iterator over the data of this container. | |
std::vector< value_type >::iterator | begin () noexcept |
Gets the beginning iterator over the data of this container. | |
void | clear () noexcept |
Clears this instance's free pool and allocated pool. | |
const value_type * | data () const noexcept |
Gets a pointer to the data of this container. | |
std::vector< value_type >::const_iterator | end () const noexcept |
Gets the ending iterator over the data of this container. | |
std::vector< value_type >::iterator | end () noexcept |
Gets the ending iterator over the data of this container. | |
bool | FindFree (size_type index) const noexcept |
Finds whether the given index is in the free list. More... | |
reference | Free (size_type index) |
Frees the previously-allocated index entry. More... | |
size_type | free_size () const noexcept |
Gets the number of elements currently free. More... | |
size_type | GetIndex (value_type *ptr) const |
Gets the index of the given pointer. More... | |
size_type | max_size () const noexcept |
Gets the maximum theoretical size this instance can have in number of elements. | |
reference | operator[] (size_type pos) |
Array index operator. More... | |
const_reference | operator[] (size_type pos) const |
Constant array index operator. More... | |
void | reserve (size_type value) |
Reserves the given number of elements from dynamic memory. More... | |
size_type | size () const noexcept |
Gets the size of this instance in number of elements. More... | |
Friends | |
bool | operator!= (const ObjectPool &lhs, const ObjectPool &rhs) noexcept |
Hidden friend operator inequality support. | |
bool | operator== (const ObjectPool &lhs, const ObjectPool &rhs) noexcept |
Hidden friend operator equality support. | |
Object pool with indexable properties.
|
inline |
Allocates an entry in the array with the given constructor parameters.
Free(size_type)
if the allocated entry needs to be freed. size() - free_size()
will return a value one less than before.
|
inline |
Allocates an entry in the array with the given instance.
Free(size_type)
if the allocated entry needs to be freed. size() - free_size()
will return a value one less than before.
|
inlinenoexcept |
Finds whether the given index is in the free list.
Referenced by playrho::ObjectPool< T >::Free().
|
inline |
Frees the previously-allocated index entry.
FindFree(size_type)
returns false
for the given index. FindFree(size_type)
returns true
for the freed index. free_size()
returns a value one greater than before. std::out_of_range | if given an index that's greater than or equal to the size of this instance as returned by size() . |
|
inlinenoexcept |
Gets the number of elements currently free.
|
inline |
Gets the index of the given pointer.
|
inline |
|
inline |
|
inline |
Reserves the given number of elements from dynamic memory.
|
inlinenoexcept |