BitArray

This struct represents an array of boolean values, each of which occupy one bit of memory for storage. Thus an array of 32 bits would occupy the same space as one integer value. The typical array operations--such as indexing and sorting--are supported, as well as bitwise operations such as and, or, xor, and complement.

Members

Functions

dim
size_t dim()

Gets the length of a uint array large enough to hold all stored bits.

dup
BitArray dup()

Duplicates this array, much like the dup property for built-in arrays.

initialize
void initialize(void[] target, size_t numbits)

Map BitArray onto target, with numbits being the number of bits in the array. Does not copy the data. This is the inverse of opCast.

length
size_t length()

Get the number of bits in this array.

length
void length(size_t newlen)

Resizes this array to newlen bits. If newlen is larger than the current length, the new bits will be initialized to zero.

opApply
int opApply(int delegate(ref bool) dg)
int opApply(int delegate(ref size_t, ref bool) dg)

Operates on all bits in this array.

opAssign
void opAssign(bool[] bits)

Resets the length of this array to bits.length and then initializes this

opBinary
BitArray opBinary(BitArray rhs)

Generates a new array which is the result of bitwise operation op between this array and the supplied array.

opBinary
BitArray opBinary(BitArray rhs)

Generates a new array which is the result of this array minus the supplied array.

opBinary
BitArray opBinary(bool rhs)
opBinaryRight
BitArray opBinaryRight(bool lhs)

Generates a new array which is the result of this array concatenated with the supplied array.

opCast
void[] opCast()

Convert this array to a void array.

opCmp
int opCmp(BitArray rhs)

Performs a lexicographical comparison of this array to the supplied array.

opEquals
int opEquals(BitArray rhs)

Compares this array to another for equality. Two bit arrays are equal if they are the same size and contain the same series of bits.

opIndex
bool opIndex(size_t pos)

Support for index operations, much like the behavior of built-in arrays.

opIndexAssign
bool opIndexAssign(bool b, size_t pos)

Support for index operations, much like the behavior of built-in arrays.

opOpAssign
BitArray opOpAssign(BitArray rhs)

Updates the contents of this array with the result of a bitwise op operation between this array and the supplied array.

opOpAssign
BitArray opOpAssign(BitArray rhs)

Updates the contents of this array with the result of this array minus the supplied array.

opOpAssign
BitArray opOpAssign(bool b)

Updates the contents of this array with the result of this array concatenated with the supplied array.

opSliceAssign
BitArray opSliceAssign(BitArray rhs)

Copy the bits from one array into this array. This is not a shallow copy.

opUnary
BitArray opUnary()

Generates a copy of this array with the unary complement operation applied.

reverse
BitArray reverse()

Reverses the contents of this array in place, much like the reverse property for built-in arrays.

sort
BitArray sort()

Sorts this array in place, with zero entries sorting before one. This is equivalent to the sort property for built-in arrays.

Static functions

opCall
BitArray opCall(bool[] bits)

This initializes a BitArray of bits.length bits, where each bit value matches the corresponding boolean value in bits.

Variables

len
size_t len;
Undocumented in source.
ptr
uint* ptr;
Undocumented in source.

Meta