tango.util.container.more.BitSet

License:

BSD style: see license.txt

Version:

Sept 2009: Initial release

since:

0.99.9

Author:

Kris
struct BitSet(int Count = 0)
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 ...
void add(size_t i)
Set the indexed bit, resizing as necessary for heap-based instances (IndexOutOfBounds for statically-sized instances)
bool has(size_t i) [const]
Test whether the indexed bit is enabled
bool and(size_t i) [const]
Like get() but a little faster for when you know the range is valid
void or(size_t i)
Turn on an indexed bit
void xor(size_t i)
Invert an indexed bit
void clr(size_t i)
Clear an indexed bit
BitSet* clr()
Clear all bits
BitSet dup() [@property, const]
Clone this BitSet and return it
size_t size() [@property, const]
Return the number of bits we have room for
BitSet* size(size_t i)
Expand to include the indexed bit (dynamic only)