Kiwaku 0.1-beta
Containers Well Made
 
Loading...
Searching...
No Matches

◆ for_each_index()

template<typename Context , typename Func , concepts::container Container>
constexpr auto kwk::for_each_index ( Context &  ctx,
Func &&  f,
Container &&  c 
)
constexpr

Simple walkthrough over all elements of a container and their coordinates.

Applies the given function object f to every elements of a given kwk::container and their current coordinates. Elements are iterated in order of the optimal memory access.

Parameters
fFunction object, to be applied to an element of c and its coordinates. The signature of the function should be equivalent to the following:
void f(T&& v, std::integral auto... is);
with T convertible to the container's value_type.
cA kwk::container on which elements f will be applied.
Returns
The function object f which could have been modified.

Example