#include "tensorstore/array.h"
template <typename Func, typename... Array>
bool tensorstore::IterateOverArrays(Func&func,
                                    
IterationConstraints constraints,
                                    
const Array&... array);

Iterates over one array or jointly iterates over multiple arrays.

For each index vector indices within the domain of the arrays, calls the element-wise function func(&array(indices)...).

Requires:

The Array types must satisfy IsArray<Array> and have compatible static ranks.

Parameters:
Func &&func

The element-wise function. Must return void or bool when invoked with (Array::Element*...). Iteration stops if the return value of func is false.

IterationConstraints constraints

Specifies constraints on the iteration order, and whether repeated elements may be skipped. If constraints.can_skip_repeated_elements(), the element-wise function may be invoked only once for multiple indices vectors that yield the same tuple of element pointers. If constraints.has_order_constraint(), func is invoked in the order given by constraints.order_constraint_value(). Otherwise, iteration is not guaranteed to occur in any particular order; an efficient iteration order is determined automatically.

const Array&... array

The arrays over which to iterate, which must all have the same shape.

Returns:

true on success, false on failure.

Checks:

ArraysHaveSameShapes(array...)