Indexed_array

template<typename Value, typename Indexer>
class indexed_array

Container that encapsulate a fixed size array, whose elements are accessible using a custom indexing mechanism instead of a zero-based integer indexing. It is an aggregate type and intend to be a drop-in replacement for std::array. The storage is guaranted to be contiguous, and can be accessed as a C-array.

Construction and destruction

Constructors

indexed_array() = default

Default construction

Copy and move constructors

indexed_array(Args&&…)

Aggregate-like initialization

indexed_array(checked_arg&&…)

Safe initialization

indexed_array(std::array const&)

Construction by copy of an array

Operators

Copy / move assignment

Destructor is explicitly defaulted.

Member functions

Data Access

Standard std::array members

Index-based element access

front

Access to first element

back

Access to last element

data

Access to raw content

Additional members

Returns a view on the lower-rank content.

Access to the underlying data.

Iteration

Iterator to the start of the array

Iterator to the end of the array (past last element)

Reverse iterator to the “beginning” of the array

Reverse iterator to the “end” of the array

Observers

std::array members

empty

Checks if container is empty

Returns the size of the array ( max_size() == size() )

fill

Fills the array with value

swap

Swap two indexed_array contents

extensions

in_range

Checks if an index is in the acceptable range

is_o1

Tells if element access is O(1)