SmartVector is a wrapper for the std::vector class that adds objects either to the end of the wrapped vector if it is full or places them in gaps.
More...
#include <smartvector.hpp>
|
| | SmartVector (size_t max_size) |
| | Creates a SmartVector instance with a maximum wrapped vector size of the given value. More...
|
| |
| | SmartVector () |
| |
| size_t | push (T object) |
| | Pushes the given object to the end of the wrapped vector if it is currently full, or to an existing empty index. More...
|
| |
| bool | set (T object, size_t index) |
| | Overwrites the object at the specified index with the given object. More...
|
| |
| size_t | pushEmpty () |
| | Adds an empty object to the end of the wrapped vector (by adding the new index to the freelist. More...
|
| |
| bool | remove (size_t index) |
| | Attempts to remove the given object at the given index of the wrapped vector. More...
|
| |
| const T | get (size_t index) const |
| | Returns the object stored at the given index if it exists, and returns nullptr otherwise. More...
|
| |
| T | get (size_t index) |
| |
| size_t | size () const |
| | Returns the number of elements allocated in the wrapped vector (including gaps) More...
|
| |
| size_t | numElements () const |
| | Returns the number of elements in the wrapped vector (not including gaps) More...
|
| |
| | DEF_SERIALIZE (Archive &ar, const unsigned int version) |
| |
template<typename
T>
class SmartVector< T >
SmartVector is a wrapper for the std::vector class that adds objects either to the end of the wrapped vector if it is full or places them in gaps.
- Template Parameters
-
| T | Type that the wrapped vector will store. |
NOTE: T must be a pointer type currently!
◆ SmartVector() [1/2]
Creates a SmartVector instance with a maximum wrapped vector size of the given value.
◆ SmartVector() [2/2]
◆ DEF_SERIALIZE()
| SmartVector< T >::DEF_SERIALIZE |
( |
Archive & |
ar, |
|
|
const unsigned int |
version |
|
) |
| |
|
inline |
◆ get() [1/2]
◆ get() [2/2]
Returns the object stored at the given index if it exists, and returns nullptr otherwise.
- Returns
- Pointer to the object stored at the given index if it exists and nullptr otherwise.
◆ numElements()
Returns the number of elements in the wrapped vector (not including gaps)
- Returns
- Number of elements in the wrapped vector not including gaps.
◆ push()
Pushes the given object to the end of the wrapped vector if it is currently full, or to an existing empty index.
- Returns
- Index at which the given object is inserted in the wrapped vector.
◆ pushEmpty()
Adds an empty object to the end of the wrapped vector (by adding the new index to the freelist.
- Returns
- Index at which the empty object is added (last index in the wrapped vector)
◆ remove()
Attempts to remove the given object at the given index of the wrapped vector.
- Returns
- true if successfully removed the object and false otherwise.
◆ set()
Overwrites the object at the specified index with the given object.
- Parameters
-
| object | object to place at the given index. |
| index | Index at which the new object will be placed. |
- Returns
- true if successfully placed the object at the given index, and false if the index is out of bounds.
◆ size()
Returns the number of elements allocated in the wrapped vector (including gaps)
- Returns
- Number of elements in the wrapped vector including gaps.
The documentation for this class was generated from the following file: