The predicate. Optimization: all!"a" has accelerated specialization for slices created with mir.ndslice.topology.bitwise, mir.ndslice.allocation.bitSlice.
Ranges and arrays
import std.range : iota; // 0 1 2 3 4 5 auto r = iota(6); assert(r.all!"a < 6"); assert(!r.all!"a < 5");
import mir.ndslice.topology : iota; // 0 1 2 // 3 4 5 auto sl = iota(2, 3); assert(sl.all!"a < 6"); assert(!sl.all!"a < 5");
Multiple slices
import mir.ndslice.topology : iota; // 0 1 2 // 3 4 5 auto sl = iota(2, 3); assert(all!"a - b == 0"(sl, sl));
Zipped slices
import mir.ndslice.topology : iota, zip; // 0 1 2 // 3 4 5 auto sl = iota(2, 3); assert(zip!true(sl, sl).all!"a.a - a.b == 0");
Mutation on-the-fly
import mir.ndslice.allocation : slice; import mir.ndslice.topology : as, iota; // 0 1 2 // 3 4 5 auto sl = iota(2, 3).as!double.slice; static bool pred(T)(ref T a) { if (a < 4) { a = 8; return true; } return false; } assert(!sl.all!pred); // sl was changed assert(sl == [[8, 8, 8], [8, 4, 5]]);
Checks if all of the elements verify pred.