A predicate.
Ranges and arrays
import std.range : iota; // 0 1 2 3 4 5 auto sl = iota(5); size_t index = sl.findIndex!"a == 3"; assert(index == 3); assert(sl[index] == 3); assert(sl.findIndex!(a => a == 8) == size_t.max);
import mir.ndslice.topology : iota; // 0 1 2 // 3 4 5 auto sl = iota(2, 3); size_t[2] index = sl.findIndex!(a => a == 3); assert(sl[index] == 3); index = sl.findIndex!"a == 6"; assert(index[0] == size_t.max); assert(index[1] == size_t.max);
find, any. Optimization: findIndex!"a" has accelerated specialization for slices created with mir.ndslice.topology.bitwise, mir.ndslice.allocation.bitSlice.
Finds an index such that pred(slices[0][index], ..., slices[$-1][index]) is true.