CORGI
An open source project by
FPL.
|
A reference object for pointing into the vector pool. It acts as a pointer for vector pool elements and can be queried to check if it has become invalid. (i.e. If the element it pointed at has either been deallocated, or replaced with a new element). More...
#include <vector_pool.h>
A reference object for pointing into the vector pool. It acts as a pointer for vector pool elements and can be queried to check if it has become invalid. (i.e. If the element it pointed at has either been deallocated, or replaced with a new element).
It also correctly handles situations where the underlying vector resizes, moving the elements around in memory.
Public Member Functions | |
VectorPoolReference () | |
Default constructor for a VectorPoolReference. | |
VectorPoolReference (VectorPool< T > *container, size_t index) | |
Constructor for a VectorPoolReference given a VectorPool. More... | |
bool | operator== (const VectorPoolReference &other) const |
Standard equality operator for VectorPoolReferences. More... | |
bool | operator!= (const VectorPoolReference &other) const |
Standard inequality operator for VectorPoolReferences. More... | |
bool | IsValid () const |
Verifies that the reference is still valid. More... | |
operator bool () const | |
An alternate way to check to make sure the reference is still valid. More... | |
T * | operator-> () |
The member access operator. More... | |
const T * | operator-> () const |
Const member access operator. More... | |
T & | operator* () |
The dereference operator. More... | |
const T & | operator* () const |
The const dereference operator. More... | |
T * | ToPointer () |
Get a direct pointer to the element the VectorPoolReference is referring to. More... | |
const T * | ToPointer () const |
Get a direct pointer to the element the VectorPoolReference is referring to. More... | |
Iterator | ToIterator () const |
Get an iterator that points to the element referenced by the VectorPoolReference. More... | |
size_t | index () const |
Get the raw index into the underlying vector for this object. More... | |
VectorPool< T > * | container () const |
Gets a pointer to the underlying vector for this object. More... | |
Friends | |
class | VectorPool< T > |
template<bool > | |
class | IteratorTemplate |
|
inline |
Constructor for a VectorPoolReference given a VectorPool.
[in] | container | A VectorPool to be referenced. |
[in] | index | The index into the VectorPool's underlying vector. |
|
inline |
Gets a pointer to the underlying vector for this object.
|
inline |
Get the raw index into the underlying vector for this object.
|
inline |
Verifies that the reference is still valid.
|
inline |
An alternate way to check to make sure the reference is still valid.
This is similar to most smart pointer types, which supply an operator bool as syntactic sugar to check if they are nullptrs.
|
inline |
Standard inequality operator for VectorPoolReferences.
[in] | other | The other VectorPoolReference to compare in-equality to. |
|
inline |
The dereference operator.
|
inline |
The const dereference operator.
|
inline |
The member access operator.
|
inline |
Const member access operator.
|
inline |
Standard equality operator for VectorPoolReferences.
[in] | other | The other VectorPoolReference to compare equality to. |
|
inline |
Get an iterator that points to the element referenced by the VectorPoolReference.
|
inline |
Get a direct pointer to the element the VectorPoolReference is referring to.
|
inline |
Get a direct pointer to the element the VectorPoolReference is referring to.