My Project
Public Types | Public Member Functions | List of all members
Sparse_array< Component > Class Template Reference

Class that handle Element of type Component like a vector which can be holed. 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 iterator = typename container_t::iterator
 
using const_iterator = typename container_t::const_iterator
 
using size_type = typename container_t::size_type
 

Public Member Functions

 Sparse_array ()=default
 Construct a new Sparse_array object.
 
 Sparse_array (Sparse_array const &sp_arr)
 Construct a new Sparse_array object. More...
 
 Sparse_array (Sparse_array &&sp_arr) noexcept
 Construct a new Sparse_array object. More...
 
 Sparse_array (std::size_t size)
 Construct a new Sparse_array object. More...
 
virtual ~Sparse_array ()=default
 Destroy the Sparse_array object.
 
Sparse_arrayoperator= (Sparse_array const &sp_arr)
 Overload the operator =. More...
 
Sparse_arrayoperator= (Sparse_array &&sp_arr) noexcept
 Overload the operator =. More...
 
reference_type operator[] (size_t idx)
 Overloads the operator []. More...
 
const_reference_type operator[] (size_t idx) const
 Overloads the operator [] const. More...
 
iterator begin ()
 Overloads the operator begin() More...
 
const_iterator begin () const
 Overloads the operator begin() const. More...
 
const_iterator cbegin () const
 Overloads the operator cbegin() const. More...
 
iterator end ()
 Overloads the operator ebd() More...
 
const_iterator end () const
 Overloads the operator end() const. More...
 
const_iterator cend () const
 Overloads the operator cend() const. More...
 
size_type size () const
 Overloads the operator size() More...
 
void extend (size_t sizeToExtend)
 Overload the operator extend() More...
 
reference_type insert_at (size_type pos, Component const &component)
 Overloads the operator insert_at() More...
 
reference_type insert_at (size_type pos, Component &&component)
 Overloads the operator insert_at() More...
 
template<class... Params>
reference_type emplace_at (size_type pos, Params &&...params)
 Overloads the operator emplace_at() More...
 
void erase (size_type pos)
 Overloads the operator erase() More...
 
size_type get_index (value_type const &val_type) const
 Get the index object. More...
 

Detailed Description

template<typename Component>
class Sparse_array< Component >

Class that handle Element of type Component like a vector which can be holed.

Template Parameters
ComponentType of element that contain the Sparse Array

Constructor & Destructor Documentation

◆ Sparse_array() [1/3]

template<typename Component >
Sparse_array< Component >::Sparse_array ( Sparse_array< Component > const &  sp_arr)
inlineexplicit

Construct a new Sparse_array object.

Parameters
sp_arrSparse Array to copy

◆ Sparse_array() [2/3]

template<typename Component >
Sparse_array< Component >::Sparse_array ( Sparse_array< Component > &&  sp_arr)
inlineexplicitnoexcept

Construct a new Sparse_array object.

Parameters
sp_arrSparse Array to copy

◆ Sparse_array() [3/3]

template<typename Component >
Sparse_array< Component >::Sparse_array ( std::size_t  size)
inlineexplicit

Construct a new Sparse_array object.

Parameters
sizeSize of the sparse array

Member Function Documentation

◆ begin() [1/2]

template<typename Component >
iterator Sparse_array< Component >::begin ( )
inline

Overloads the operator begin()

Returns
iterator The first element iterator

◆ begin() [2/2]

template<typename Component >
const_iterator Sparse_array< Component >::begin ( ) const
inline

Overloads the operator begin() const.

Returns
const_iterator The first element iterator

◆ cbegin()

template<typename Component >
const_iterator Sparse_array< Component >::cbegin ( ) const
inline

Overloads the operator cbegin() const.

Returns
const_iterator The first element iterator

◆ cend()

template<typename Component >
const_iterator Sparse_array< Component >::cend ( ) const
inline

Overloads the operator cend() const.

Returns
const_iterator The last element iterator

◆ emplace_at()

template<typename Component >
template<class... Params>
reference_type Sparse_array< Component >::emplace_at ( size_type  pos,
Params &&...  params 
)
inline

Overloads the operator emplace_at()

Template Parameters
ParamsType of param to emplace
Parameters
posIndex where add the component
paramsParams to add
Returns
reference_type Element added at index

◆ end() [1/2]

template<typename Component >
iterator Sparse_array< Component >::end ( )
inline

Overloads the operator ebd()

Returns
iterator The last element iterator

◆ end() [2/2]

template<typename Component >
const_iterator Sparse_array< Component >::end ( ) const
inline

Overloads the operator end() const.

Returns
const_iterator The last element iterator

◆ erase()

template<typename Component >
void Sparse_array< Component >::erase ( size_type  pos)
inline

Overloads the operator erase()

Parameters
posIndex where erase elem

◆ extend()

template<typename Component >
void Sparse_array< Component >::extend ( size_t  sizeToExtend)
inline

Overload the operator extend()

Parameters
sizeToExtendSize to extend

◆ get_index()

template<typename Component >
size_type Sparse_array< Component >::get_index ( value_type const &  val_type) const
inline

Get the index object.

Parameters
val_type
Returns
size_type

◆ insert_at() [1/2]

template<typename Component >
reference_type Sparse_array< Component >::insert_at ( size_type  pos,
Component &&  component 
)
inline

Overloads the operator insert_at()

Parameters
posIndex where add the component
componentcomponent to add
Returns
reference_type Element added at index

◆ insert_at() [2/2]

template<typename Component >
reference_type Sparse_array< Component >::insert_at ( size_type  pos,
Component const &  component 
)
inline

Overloads the operator insert_at()

Parameters
posIndex where add the component
componentcomponent to add
Returns
reference_type Element added at index

◆ operator=() [1/2]

template<typename Component >
Sparse_array& Sparse_array< Component >::operator= ( Sparse_array< Component > &&  sp_arr)
inlinenoexcept

Overload the operator =.

Parameters
sp_arrSparse Array to add
Returns
Sparse_array& himself

◆ operator=() [2/2]

template<typename Component >
Sparse_array& Sparse_array< Component >::operator= ( Sparse_array< Component > const &  sp_arr)
inline

Overload the operator =.

Parameters
sp_arrSparse Array to add
Returns
Sparse_array& himself

◆ operator[]() [1/2]

template<typename Component >
reference_type Sparse_array< Component >::operator[] ( size_t  idx)
inline

Overloads the operator [].

Parameters
idxIndex to get in the Sparse Array
Returns
reference_type Element at index

◆ operator[]() [2/2]

template<typename Component >
const_reference_type Sparse_array< Component >::operator[] ( size_t  idx) const
inline

Overloads the operator [] const.

Parameters
idxIndex to get in the Sparse Array
Returns
const_reference_type Element at index

◆ size()

template<typename Component >
size_type Sparse_array< Component >::size ( ) const
inline

Overloads the operator size()

Returns
size_type The size of the Sparse Array

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