|
| Bitset (bool defaultValue=false) |
| Create an empty bitset. More...
|
|
| Bitset (BaseType &&base, bool defaultValue) |
| Create a bitset from a BaseType object. More...
|
|
| Bitset (const std::initializer_list< std::size_t > &bits, bool defaultValue=false) |
| Create a bitset from a list of bits indices that shall be set to true. More...
|
|
auto | resize (std::size_t num_bits, bool value) const |
| Resize the Bitset to hold at least num_bits bits. New bits are set to the given value. More...
|
|
auto | resize (std::size_t num_bits) const |
| Resize the Bitset to hold at least num_bits bits. New bits are set to mDefault. More...
|
|
Bitset & | operator-= (const Bitset &rhs) |
| Sets all bits to false that are true in rhs. More...
|
|
Bitset & | operator&= (const Bitset &rhs) |
| Computes the bitwise and with rhs. More...
|
|
Bitset & | operator|= (const Bitset &rhs) |
| Computes the bitwise or with rhs. More...
|
|
Bitset & | set (std::size_t n, bool value=true) |
| Sets the given bit to a value, true by default. More...
|
|
Bitset & | set_interval (std::size_t start, std::size_t end, bool value=true) |
| Sets the a range of bits to a value, true by default. More...
|
|
Bitset & | reset (std::size_t n) |
| Resets a bit to false. More...
|
|
bool | test (std::size_t n) const |
| Retrieves the value of the given bit. More...
|
|
bool | any () const |
| Checks if any bits are set to true. Asserts that mDefault is false. More...
|
|
bool | none () const |
| Checks if no bits are set to true. Asserts that mDefault is false. More...
|
|
auto | count () const noexcept |
| Counts the number of bits that are set to true. Asserts that mDefault is false. More...
|
|
auto | size () const |
| Retrieves the size of mData. More...
|
|
auto | num_blocks () const |
| Retrieves the number of blocks used to store mData. More...
|
|
auto | is_subset_of (const Bitset &rhs) const |
| Checks wether the bits set is a subset of the bits set in rhs. More...
|
|
std::size_t | find_first () const |
| Retrieves the index of the first bit that is set to true. More...
|
|
std::size_t | find_next (std::size_t pos) const |
| Retrieves the index of the first bit set to true after the given position. More...
|
|
iterator | begin () const |
| Returns an iterator to the first bit that is set to true. More...
|
|
iterator | end () const |
| Returns an past-the-end iterator. More...
|
|
This class is a simple wrapper around boost::dynamic_bitset.
Its purpose is to allow for on-the-fly resizing of the bitset. Formally, a Bitset object represents an infinite bitset that starts with the bits stored in mData extended by mDefault. Whenever a bit is written that is not yet stored explicitly in mData or two Bitset objects with different mData sizes are involved, the size of mData is expanded transparently.
Note that some operations only make sense for a certain value of mDefault
. For example, any()
or none()
require mDefault
to be false
.
Definition at line 20 of file Bitset.h.