ubyte[20] d;
assert(d.allZero); // note that [] is needed here
ubyte[2][2] zeros = [ [0, 0],
[0, 0] ];
assert(zeros.allZero);
ubyte[2][2] one = [ [0, 1],
[0, 0] ];
assert(!one.allZero);
ubyte[2][2] ones = [ [1, 1],
[1, 1] ];
assert(!ones.allZero);
ubyte[2][2][2] zeros3d = [ [ [0, 0],
[0, 0] ],
[ [0, 0],
[0, 0] ] ];
assert(zeros3d.allZero);
ubyte[2][2][2] ones3d = [ [ [1, 1],
[1, 1] ],
[ [1, 1],
[1, 1] ] ];
assert(!ones3d.allZero);
struct Vec { real x, y; }
const v0 = Vec(0, 0);
assert(v0.zeroed);
const v1 = Vec(1, 1);
assert(!v1.zeroed);
class Vec
{
this(real x, real y) { this.x = x; this.y = y; }
real x, y;
}
const v0 = new Vec(0, 0);
assert(v0.zeroed);
const v1 = new Vec(1, 1);
assert(!v1.zeroed);
Check if all Elements of x are zero.