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 operationssuch as indexing
and sortingare supported, as well as bitwise operations such as and, or,
xor, and complement.
 BitArray opCall(bool[] bits) [static] ¶#

This initializes a BitArray of bits.length bits, where each bit value
matches the corresponding boolean value in bits.
bits  The initialization value. 
A BitArray with the same number and sequence of elements as bits.
 size_t length() ¶#

Get the number of bits in this array.
The number of bits in this array.
 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.
newlen  The number of bits this array should contain. 
 size_t dim() ¶#

Gets the length of a uint array large enough to hold all stored bits.
The size a uint array would have to be to store this array.
 BitArray dup() ¶#

Duplicates this array, much like the dup property for builtin arrays.
A duplicate of this array.
 void opAssign(bool[] bits) ¶#

Resets the length of this array to bits.length and then initializes this
Resizes this array to hold bits.length bits and initializes each bit
value to match the corresponding boolean value in bits.
bits  The initialization value. 
 BitArray opSliceAssign(BitArray rhs) ¶#

Copy the bits from one array into this array. This is not a shallow
copy.
rhs  A BitArray with at least the same number of bits as this bit
array. 
A shallow copy of this array.
1
2
3
4
5
6
 BitArray ba = [0,1,0,1,0];
BitArray ba2;
ba2.length = ba.length;
ba2[] = ba; // perform the copy
ba[0] = true;
assert(ba2[0] == false);

 void init(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.
target  The array to map. 
numbits  The number of bits to map in target. 
 BitArray reverse() ¶#

Reverses the contents of this array in place, much like the reverse
property for builtin arrays.
A shallow copy of this array.
 BitArray sort() ¶#

Sorts this array in place, with zero entries sorting before one. This
is equivalent to the sort property for builtin arrays.
A shallow copy of this array.
 int opApply(int delegate(ref bool) dg) ¶#
 int opApply(int delegate(ref size_t, ref bool) dg) ¶#

Operates on all bits in this array.
dg  The supplied code as a delegate. 
 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.
rhs  The array to compare against. 
Zero if not equal and nonzero otherwise.
 int opCmp(BitArray rhs) ¶#

Performs a lexicographical comparison of this array to the supplied
array.
rhs  The array to compare against. 
A value less than zero if this array sorts before the supplied array,
zero if the arrays are equavalent, and a value greater than zero if
this array sorts after the supplied array.
 void[] opCast() ¶#

Convert this array to a void array.
This array represented as a void array.
 bool opIndex(size_t pos) ¶#

Support for index operations, much like the behavior of builtin arrays.
pos  The desired index position. 
pos must be less than the length of this array.
The value of the bit at pos.
 BitArray opCom() ¶#

Generates a copy of this array with the unary complement operation
applied.
A new array which is the complement of this array.
 BitArray opAnd(BitArray rhs) ¶#

Generates a new array which is the result of a bitwise and operation
between this array and the supplied array.
rhs  The array with which to perform the bitwise and operation. 
rhs.length must equal the length of this array.
A new array which is the result of a bitwise and with this array and
the supplied array.
 BitArray opOr(BitArray rhs) ¶#

Generates a new array which is the result of a bitwise or operation
between this array and the supplied array.
rhs  The array with which to perform the bitwise or operation. 
rhs.length must equal the length of this array.
A new array which is the result of a bitwise or with this array and
the supplied array.
 BitArray opXor(BitArray rhs) ¶#

Generates a new array which is the result of a bitwise xor operation
between this array and the supplied array.
rhs  The array with which to perform the bitwise xor operation. 
rhs.length must equal the length of this array.
A new array which is the result of a bitwise xor with this array and
the supplied array.
 BitArray opSub(BitArray rhs) ¶#

Generates a new array which is the result of this array minus the
supplied array. a  b for BitArrays means the same thing as
a & ~b.
rhs  The array with which to perform the subtraction operation. 
rhs.length must equal the length of this array.
A new array which is the result of this array minus the supplied array.
 BitArray opCat(bool rhs) ¶#
 BitArray opCat_r(bool lhs) ¶#
 BitArray opCat(BitArray rhs) ¶#

Generates a new array which is the result of this array concatenated
with the supplied array.
rhs  The array with which to perform the concatenation operation. 
A new array which is the result of this array concatenated with the
supplied array.
 bool opIndexAssign(bool b, size_t pos) ¶#

Support for index operations, much like the behavior of builtin arrays.
b  The new bit value to set. 
pos  The desired index position. 
pos must be less than the length of this array.
The new value of the bit at pos.
 BitArray opAndAssign(BitArray rhs) ¶#

Updates the contents of this array with the result of a bitwise and
operation between this array and the supplied array.
rhs  The array with which to perform the bitwise and operation. 
rhs.length must equal the length of this array.
A shallow copy of this array.
 BitArray opOrAssign(BitArray rhs) ¶#

Updates the contents of this array with the result of a bitwise or
operation between this array and the supplied array.
rhs  The array with which to perform the bitwise or operation. 
rhs.length must equal the length of this array.
A shallow copy of this array.
 BitArray opXorAssign(BitArray rhs) ¶#

Updates the contents of this array with the result of a bitwise xor
operation between this array and the supplied array.
rhs  The array with which to perform the bitwise xor operation. 
rhs.length must equal the length of this array.
A shallow copy of this array.
 BitArray opSubAssign(BitArray rhs) ¶#

Updates the contents of this array with the result of this array minus
the supplied array. a  b for BitArrays means the same thing as
a & ~b.
rhs  The array with which to perform the subtraction operation. 
rhs.length must equal the length of this array.
A shallow copy of this array.
 BitArray opCatAssign(bool b) ¶#
 BitArray opCatAssign(BitArray rhs) ¶#

Updates the contents of this array with the result of this array
concatenated with the supplied array.
rhs  The array with which to perform the concatenation operation. 
A shallow copy of this array.