CkPttn 1.2.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ShiftArray< Container > Class Template Reference

Shift Array container with shifted index access. More...

#include <array_like.hpp>

Inheritance diagram for ShiftArray< Container >:
Inheritance graph
[legend]
Collaboration diagram for ShiftArray< Container >:
Collaboration graph
[legend]

Public Member Functions

 ShiftArray ()
 Construct a new Shift Array object.
 
 ShiftArray (Container &&base)
 Construct a new Shift Array object.
 
void set_start (const size_t &start)
 Set the start index for shifted access.
 
auto operator[] (const size_t &index) const -> const value_type &
 Access element with shifted index (const version).
 
auto operator[] (const size_t &index) -> value_type &
 Access element with shifted index (non-const version).
 

Detailed Description

template<typename Container>
class ShiftArray< Container >

Shift Array container with shifted index access.

The ShiftArray class extends a given container type to allow accessing elements using shifted indices. The shift value is set using set_start, and shifted indices are calculated by subtracting the shift value from the original index.

Template Parameters
ContainerThe underlying container type (e.g. std::vector)

Constructor & Destructor Documentation

◆ ShiftArray() [1/2]

template<typename Container >
ShiftArray< Container >::ShiftArray ( )
inline

Construct a new Shift Array object.

◆ ShiftArray() [2/2]

template<typename Container >
ShiftArray< Container >::ShiftArray ( Container &&  base)
inlineexplicit

Construct a new Shift Array object.

Parameters
[in]base

Member Function Documentation

◆ operator[]() [1/2]

template<typename Container >
auto ShiftArray< Container >::operator[] ( const size_t &  index) -> value_type&
inline

Access element with shifted index (non-const version).

Parameters
[in]indexThe shifted index
Returns
value_type& Reference to the element

◆ operator[]() [2/2]

template<typename Container >
auto ShiftArray< Container >::operator[] ( const size_t &  index) const -> const value_type&
inline

Access element with shifted index (const version).

Parameters
[in]indexThe shifted index
Returns
const value_type& Reference to the element

◆ set_start()

template<typename Container >
void ShiftArray< Container >::set_start ( const size_t &  start)
inline

Set the start index for shifted access.

Parameters
[in]startThe starting index offset

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