The OpenD Programming Language

BitArray.count

Counts all the set bits in the BitArray

struct BitArray
const scope @safe @nogc pure nothrow
size_t
count
()

Examples

auto a = BitArray([0, 1, 1, 0, 0, 1, 1]);
assert(a.count == 4);

BitArray b;
assert(b.count == 0);

bool[200] boolArray;
boolArray[45 .. 130] = true;
auto c = BitArray(boolArray);
assert(c.count == 85);

Meta