PERRY v1.0.0
P-E-R-R-Y/PERRY helps creating games with a bunch of tools.
Loading...
Searching...
No Matches
ecs::SparseArray< Component > Class Template Reference

SparseArray class. More...

#include <SparseArray.hpp>

Public Types

using value_type = std::optional<Component>
 
using reference_type = value_type &
 
using const_reference_type = value_type const &
 
using container_t = std::vector<value_type>
 
using size_type = typename container_t::size_type
 
using iterator = typename container_t::iterator
 
using const_iterator = typename container_t::const_iterator
 

Public Member Functions

 SparseArray ()=default
 construct a new SparseArray object
 
 SparseArray (SparseArray const &)=default
 copy constructor
 
 SparseArray (SparseArray &&) noexcept=default
 move constructor
 
 ~SparseArray ()=default
 Destroy the Sparse Array object.
 
SparseArrayoperator= (SparseArray const &)=default
 copy operator=
 
SparseArrayoperator= (SparseArray &&) noexcept=default
 move operator=
 
reference_type operator[] (size_t idx)
 give the value at the index idx of the SparseArray
 
const_reference_type operator[] (size_t idx) const
 give the value at the index idx of the SparseArray (const)
 
iterator begin ()
 give a iterator at the begining of the SparseArray
 
const_iterator begin () const
 give a const_iterator at the begining of the SparseArray
 
const_iterator cbegin () const
 give a const_iterator at the begining of the SparseArray
 
iterator end ()
 give a iterator at the end of the SparseArray
 
const_iterator end () const
 give a const_iterator at the end of the SparseArray
 
const_iterator cend () const
 give a const_iterator at the end of the SparseArray
 
size_type size () const
 give the size of the SparseArray
 
reference_type insertAt (size_type pos, Component const &c)
 insert a component at the given position & return a reference to it
 
reference_type insertAt (size_type pos, Component &&c)
 insert a component at the given position & return a reference to it
 
template<class ... Params>
reference_type emplaceAt (size_type pos, Params &&...args)
 emplace a component at the given position & return a reference to it
 
void erase (size_type pos)
 erase the component at the given position
 
size_type getIndex (const value_type &v) const
 get the index of the given value
 
void print () const
 print the SparseArray
 

Private Attributes

container_t _data
 

Detailed Description

template<typename Component>
class ecs::SparseArray< Component >

SparseArray class.

Template Parameters
Component

The documentation for this class was generated from the following file: