Public Member Functions | |
Bitset (size_type max) | |
Default constructor. | |
Bitset (size_type max, const data_type *data) | |
Constructor with user-provided bit field. | |
Bitset (const Bitset &bs) | |
Copy constructor. | |
template<class InputIterator> | Bitset (InputIterator first, InputIterator last) |
Constructor from Input Iterators. | |
~Bitset () | |
Standard destructor. | |
Bitset & | operator= (const Bitset &rhs) |
Affectation. | |
void | swap (Bitset &other) |
Swap with another Bitset. | |
void | clear () |
Clear the set. | |
iterator | find (const key_type &x) const |
Find an element in the set. | |
size_type | count (const key_type &x) const |
Used for compatibility with std::set. Returns 0 or 1. | |
bool | operator[] (const key_type &x) const |
Returns the xth bit. | |
Bitset | project (const Bitset &b) const |
Project the set onto another bitset. The result is space-optimized. | |
Bitset | unproject (const Bitset &b) const |
Inverse function of project. | |
unsigned | to_unsigned () const |
Reinterpret bits as unsigned int. | |
template<typename Type> const Type | cast () const |
Reinterpret bits as another type. | |
std::ostream & | print (std::ostream &ostr) const |
Print the set. | |
iterator | begin () |
Iterators. | |
const_iterator | begin () const |
Iterators. | |
iterator | end () |
Iterators. | |
const_iterator | end () const |
Iterators. | |
reverse_iterator | rbegin () |
Reverse iterators. | |
const_reverse_iterator | rbegin () const |
Reverse iterators. | |
reverse_iterator | rend () |
Reverse iterators. | |
const_reverse_iterator | rend () const |
Reverse iterators. | |
std::pair< iterator, bool > | insert (const value_type &x) |
Insert an element into the set. | |
iterator | insert (iterator position, const value_type &x) |
Insert an element into the set. | |
template<class InputIterator> void | insert (InputIterator first, InputIterator last) |
Insert an element into the set. | |
void | erase (iterator position) |
Erase an element from the set. | |
size_type | erase (const key_type &x) |
Erase an element from the set. | |
void | erase (iterator first, iterator last) |
Erase an element from the set. | |
Protected Member Functions | |
bool | get_bit (size_type index, size_type bit) const |
Get a bit inside data_. | |
size_type | compute_size () const |
Recalculate the set's size when invalid. | |
bool | get_bit (const bit_iterator &it) const |
Get a bit inside data_ given an iterator. | |
template<class BitAction> bool | do_on_bit (BitAction &action, const key_type &x) |
Perform an action onto the bit corresponding to an element. | |
template<class BitAction> bool | do_on_bit (BitAction &action, const bit_iterator &it) |
Perform an action onto the bit corresponding to an element. | |
template<class ConstBitAction> bool | do_on_bit (ConstBitAction &action, const key_type &x) const |
Perform an action onto the bit corresponding to an element, const. | |
template<class ConstBitAction> bool | do_on_bit (ConstBitAction &action, const bit_iterator &it) const |
Perform an action onto the bit corresponding to an element, const. | |
Static Protected Member Functions | |
size_type | get_data_size (size_type max) |
Calculates the number of data_type needed for the set. | |
size_type | get_index (const key_type &x) |
Get the index of x in the data_ attribute. | |
size_type | get_bitnum (const key_type &x) |
Get the bit number of x inside the data_[i] attribute. |
This is a dynamic bitset implementation which behave almost like a std::set<int>.
|
Default constructor.
|
|
Inverse function of project. S.project(T).unproject(T) == S cap T
|