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

Aliases

opAnd
alias opAnd = and
Undocumented in source.
opOrAssign
alias opOrAssign = or
Undocumented in source.
opXorAssign
alias opXorAssign = xor
Undocumented in source.

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

dup
BitSet dup()

Clone this BitSet and return it

has
bool has(size_t i)

Test whether the indexed bit is enabled

or
void or(size_t i)

Turn on an indexed bit

size
size_t size()

Return the number of bits we have room for

size
BitSet* size(size_t i)

Expand to include the indexed bit (dynamic only)

xor
void xor(size_t i)

Invert an indexed bit

Meta