-
#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 functionfunc(&array(indices)...)
.- Requires:¶
The
Array
types must satisfyIsArray<Array>
and have compatible static ranks.- Parameters:¶
- Func &&func¶
The element-wise function. Must return
void
orbool
when invoked with(Array::Element*...)
. Iteration stops if the return value offunc
isfalse
.- 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 multipleindices
vectors that yield the same tuple of element pointers. Ifconstraints.has_order_constraint()
,func
is invoked in the order given byconstraints.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:¶