devolve

Fixed-Sized Bit-Array.

License
Boost License 1.0.
Authors
Per Nordlöw

struct  BitSet(size_t len, Block = size_t);

Statically sized bitarray


pure nothrow @safe size_t  dim();

Gets the amount of native words backing this BitSet.


pure nothrow @safe size_t  length();

Gets the amount of bits in the BitSet.


const pure nothrow @trusted bool  opIndex(size_t i);

Gets the i'th bit in the BitSet.


const pure nothrow @trusted bool  at(size_t i)();

Gets the i'th bit in the BitSet. Statically verifies that i is < BitSet length.


const pure nothrow @safe BitSet  dup();

Duplicates the BitSet and its contents.


int  opApply(scope int delegate(ref bool) dg);
const int  opApply(scope int delegate(bool) dg);
int  opApply(scope int delegate(ref size_t, ref bool) dg);
const int  opApply(scope int delegate(size_t, bool) dg);

Support for foreach loops for BitSet.


BitSet  reverse();

Reverses the bits of the BitSet in place.


BitSet  sort();

Sorts the BitSet's elements.


bool  opEquals(in BitSet a2);

Support for operators == and != for BitSet.


const int  opCmp(in BitSet a2);

Supports comparison operators for BitSet.


const pure nothrow @trusted size_t  toHash();

Support for hashing for BitSet.


this(bool[] ba);

Set this BitSet to the contents of ba.


const pure nothrow @safe bool  allZero();

Check if this BitSet has only zeros.


void[]  opCast(T : void[])();

Map the BitSet onto v, with numbits being the number of bits in the array. Does not copy the data.

This is the inverse of  opCast.

Convert to void[].


size_t[]  opCast(T : size_t[])();

Convert to size_t[].


const BitSet  opCom();

Support for unary operator ~ for BitSet.


const BitSet  opAnd(in BitSet e2);

Support for binary operator & for BitSet.


const BitSet  opOr(in BitSet e2);

Support for binary operator | for BitSet.


const BitSet  opXor(in BitSet e2);

Support for binary operator ^ for BitSet.


const BitSet  opSub(in BitSet e2);

Support for binary operator - for BitSet.

a - b for BitSet means the same thing as a & ~b.


BitSet  opAndAssign(in BitSet e2);

Support for operator &= for BitSet.


BitSet  opOrAssign(in BitSet e2);

Support for operator |= for BitSet.


BitSet  opXorAssign(in BitSet e2);

Support for operator ^= for BitSet.


BitSet  opSubAssign(in BitSet e2);

Support for operator -= for BitSet.

a -= b for BitSet means the same thing as a &= ~b.


const void  toString(scope void delegate(const(char)[]) sink, FormatSpec!char fmt);

Return a string representation of this BitSet.

Two format specifiers are supported:

  • %s which prints the bits as an array, and
  • %b which prints the bits as 8-bit byte packets
  • separated with an underscore.