expression value
import mir.ndslice.topology: iota; import mir.ndslice.allocation: slice; auto scalar = 3; auto vector = 3.iota.slice; // [0, 1, 2] // scalar = 5; scalar.ndassign = 5; assert(scalar == 5); // vector[] = vector * 2; vector.ndassign = vector * 2; assert(vector == [0, 2, 4]); // vector[] += scalar; vector.ndassign!"+"= scalar; assert(vector == [5, 7, 9]);
Assignment utility for generic code that works both with scalars and with ndslices.