# Indexes

soa1d_container's and aos1d_container's accessors [] operator can accept an integer based loop index. However if any modifications were applied to that loop index, the fact that it's a loop index may be lost by the compiler as it is handled before being passed to the [] operator.

To avoid this situation, SDLT provides classes to wrap loop indexes that capture multiple additions or subtractions of offsets (see the Offsets section). The resulting index can be passed to [] and preserve the original loop index and track any arithmetic with Offsets to be applied to underlying data layout.

It is common for stencil based algorithms to need to apply offsets during data access.

For a regular linear loop, use linear_index to wrap your loop index.

Parent topic: User-Level Interface

- linear_index
  Wraps an integer-based loop index that is iterating linearly through an iteration space. `#include <sdlt/linear_index.h>`
- n_index_t (needs new content)
  Variadic template class n_index_t describes a position inside of the N-dimensional container. Specifically, the number of dimensions and the of index value of each.
- n_index_generator
  To facilitate simpler creation of n_index_t objects, the generator object n_index is provided.
- index_d template function