The OpenD Programming Language

BitArray.opCmp

Supports comparison operators for BitArray.

struct BitArray
const @nogc pure nothrow @system
int
opCmp

Examples

bool[] ba = [1,0,1,0,1];
bool[] bb = [1,0,1];
bool[] bc = [1,0,1,0,1,0,1];
bool[] bd = [1,0,1,1,1];
bool[] be = [1,0,1,0,1];
bool[] bf = [1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];
bool[] bg = [1,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0];

auto a = BitArray(ba);
auto b = BitArray(bb);
auto c = BitArray(bc);
auto d = BitArray(bd);
auto e = BitArray(be);
auto f = BitArray(bf);
auto g = BitArray(bg);

assert(a >  b);
assert(a >= b);
assert(a <  c);
assert(a <= c);
assert(a <  d);
assert(a <= d);
assert(a == e);
assert(a <= e);
assert(a >= e);
assert(f <  g);
assert(g <= g);

Meta