Indexed_array iterators

indexed_array provides random access iterators, with O(1) complexity. These iterators are valid as long as the object exists, no operation on indexed_array does iterator invalidation.

begin

These functions return an iterator to the beginning of the indexed_array. If the array is empty, the iterator will be equal to end().

constexpr iterator indexed_array::begin()
constexpr const_iterator indexed_array::begin() const
constexpr const_iterator indexed_array::cbegin() const

end

These functions return an iterator which is immediately after the last element. It is undefined behaviour to try to dereference such an iterator.

constexpr iterator indexed_array::end()
constexpr const_iterator indexed_array::end() const
constexpr const_iterator indexed_array::cend() const

rbegin

These functions return a reverse iterator to the first element of the reversed indexed_array (which is the last element of the array). If the array is empty, then it is equal to rend().

See https://en.cppreference.com/w/cpp/container/array/rbegin for a detailed explanation on reverse iteration.

constexpr reverse_iterator indexed_array::rbegin()
constexpr const_reverse_iterator indexed_array::rbegin() const
constexpr const_reverse_iterator indexed_array::crbegin() const

rend

These functions return a reverse iterator which is past the last element of the reversed indexed_array. It is undefined behaviour to try to dereference such an iterator.

constexpr reverse_iterator indexed_array::rend()
constexpr const_reverse_iterator indexed_array::rend() const
constexpr const_reverse_iterator indexed_array::crend() const

Multidimensional arrays

Warning

Special care should be taken when using iterators and multidimensional arrays. Iterators always iterate through the whole array, and not through the highest-rank dimension.