R-Type
|
Array which can have empty indexes. More...
#include <SparseArray.hpp>
Public Types | |
using | valueType = std::optional< Component > |
Type of the array wrap in an optional. More... | |
using | referenceType = valueType & |
Reference to valueType. More... | |
using | constReferenceType = const valueType & |
Constant reference to valueType. More... | |
using | container = std::vector< valueType > |
Type of the container, which is a a vector storing a valueType. More... | |
using | sizeType = typename container::size_type |
Type of the size of the container. More... | |
using | iterator = typename container::iterator |
Type of the container's iterator. More... | |
using | constIterator = typename container::const_iterator |
Constant type of the container's iterator. More... | |
Public Member Functions | |
SparseArray () | |
SparseArray's constructor. More... | |
SparseArray (const SparseArray &sparseArray) | |
Copy constructor for the SparseArray. More... | |
~SparseArray ()=default | |
SparseArray & | operator= (const SparseArray &sparseArray) |
Overload for the copy assignement operator. More... | |
SparseArray & | operator= (SparseArray &&sparseArray) noexcept |
Overload for the move assignment operator. More... | |
referenceType | operator[] (std::size_t idx) |
Overload for the bracket operator. More... | |
constReferenceType | operator[] (std::size_t idx) const |
Overload for the bracket operator. More... | |
iterator | begin () |
Getter for the begin iterator. More... | |
constIterator | begin () const |
Getter for the begin iterator. More... | |
constIterator | cbegin () const |
Getter for the begin iterator. More... | |
iterator | end () |
Getter for the end iterator. More... | |
constIterator | end () const |
Getter for the end iterator. More... | |
constIterator | cend () const |
Getter for the end iterator. More... | |
sizeType | size () const |
Getter for the array's size. More... | |
referenceType | insert_at (sizeType pos, const Component &component) |
Insert a copy of the component at the position specified. Will resize the array if the position is bigger than the size of the array. More... | |
referenceType | insert_at (sizeType pos, Component &&component) |
Insert the component at the position specified, the component will be moved in. Will resize the array if the position is bigger than the size of the array. More... | |
referenceType | emplace_at (sizeType pos) |
Creates the component at the specified position. More... | |
template<class... Params> | |
referenceType | emplace_at (sizeType pos, Params &&...params) |
Creates components at the specified positions. More... | |
void | erase (sizeType pos) |
Removes the component at the specified position. More... | |
sizeType | getIndex (const valueType &val) const |
Getter for the index of the component given. The component needs to be in the array. More... | |
void | resize (const std::size_t &count) |
Resize the array. More... | |
Array which can have empty indexes.
Component | Type of the component in the array. |
using SparseArray< Component >::constIterator = typename container::const_iterator |
Constant type of the container's iterator.
using SparseArray< Component >::constReferenceType = const valueType & |
Constant reference to valueType.
using SparseArray< Component >::container = std::vector<valueType> |
Type of the container, which is a a vector storing a valueType.
using SparseArray< Component >::iterator = typename container::iterator |
Type of the container's iterator.
using SparseArray< Component >::referenceType = valueType & |
Reference to valueType.
using SparseArray< Component >::sizeType = typename container::size_type |
Type of the size of the container.
using SparseArray< Component >::valueType = std::optional<Component> |
Type of the array wrap in an optional.
|
inline |
SparseArray's constructor.
|
inline |
Copy constructor for the SparseArray.
sparseArray | SparseArray to copy. |
|
default |
|
inline |
Getter for the begin iterator.
|
inline |
Getter for the begin iterator.
|
inline |
Getter for the begin iterator.
|
inline |
Getter for the end iterator.
|
inline |
Creates the component at the specified position.
pos | Position to create the component at. |
|
inline |
Creates components at the specified positions.
...Params | Variadic template of the type of the positions |
pos | First position to create the component. |
...params | Variadic parameter of the positions to insert at. |
|
inline |
Getter for the end iterator.
|
inline |
Getter for the end iterator.
|
inline |
Removes the component at the specified position.
pos | Position at which to remove the component. |
|
inline |
Getter for the index of the component given. The component needs to be in the array.
val | Component from which to get the index. |
|
inline |
Insert the component at the position specified, the component will be moved in. Will resize the array if the position is bigger than the size of the array.
pos | Position to insert the component at. |
component | Moved component to insert. |
|
inline |
Insert a copy of the component at the position specified. Will resize the array if the position is bigger than the size of the array.
pos | Position to insert the component at. |
component | Copy of the component to insert. |
|
inline |
Overload for the copy assignement operator.
sparseArray | SparseArray to copy. |
|
inlinenoexcept |
Overload for the move assignment operator.
sparseArray | SparseArray to move. |
|
inline |
Overload for the bracket operator.
idx | Index to get the value at. |
|
inline |
Overload for the bracket operator.
idx | Index to get the value at. |
|
inline |
Resize the array.
count | Size to resize the array. |
|
inline |
Getter for the array's size.