#include <ckpttn/array_like.hpp>
template<typename Container>
ShiftArray class
Shift Array.
Template parameters | |
---|---|
Container |
The ShiftArray
class is a template class that extends a given container type. It allows accessing elements of the container using shifted indices. The shift value is set using the set_start
method, and the shifted indices are calculated by subtracting the shift value from the original index. The class provides operator[]
overloads to access elements using shifted indices.
Constructors, destructors, conversion operators
- ShiftArray()
- Construct a new Shift Array object.
- ShiftArray(Container&& base) explicit
- Construct a new Shift Array object.
Public functions
- void set_start(const size_t& start)
- Set the start object.
- auto operator[](const size_t& index) const -> const value_type & -> auto
- auto operator[](const size_t& index) -> value_type & -> auto
Function documentation
template<typename Container>
ShiftArray<Container>:: ShiftArray(Container&& base) explicit
Construct a new Shift Array object.
Parameters | |
---|---|
base in |
template<typename Container>
void ShiftArray<Container>:: set_start(const size_t& start)
Set the start object.
Parameters | |
---|---|
start in |
template<typename Container>
auto ShiftArray<Container>:: operator[](const size_t& index) const -> const value_type &
Parameters | |
---|---|
index in | |
Returns | const value_type& |
template<typename Container>
auto ShiftArray<Container>:: operator[](const size_t& index) -> value_type &
Parameters | |
---|---|
index in | |
Returns | value_type& |