BitSet

A fixed or dynamic set of bits. Note that this does no memory allocation of its own when Size != 0, and does heap allocation when Size is zero. Thus you can have a fixed-size low-overhead 'instance, or a heap oriented instance. The latter has support for resizing, whereas the former does not.

Note that leveraging intrinsics is slower when using dmd ...

Members

Functions

add
void add(size_t i)

Set the indexed bit, resizing as necessary for heap-based instances (IndexOutOfBounds for statically-sized instances)

and
bool and(size_t i)

Like get() but a little faster for when you know the range is valid

clr
void clr(size_t i)

Clear an indexed bit

clr
BitSet* clr()

Clear all bits

has
bool has(size_t i)

Test whether the indexed bit is enabled

opBinary
bool opBinary(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(size_t i)
Undocumented in source. Be warned that the author may not have intended to support it.
or
void or(size_t i)

Turn on an indexed bit

size
BitSet* size(size_t i)

Expand to include the indexed bit (dynamic only)

xor
void xor(size_t i)

Invert an indexed bit

Properties

dup
BitSet dup [@property getter]

Clone this BitSet and return it

size
size_t size [@property getter]

Return the number of bits we have room for

Meta