|
spot 2.16
|
A bit vector. More...
#include <spot/misc/bitvect.hh>
Public Types | |
| typedef unsigned long | block_t |
| Storage block type. | |
Public Member Functions | |
| bitvect (const bitvect &other) | |
| Copy constructor. | |
| bitvect * | clone () const |
| Return a heap-allocated copy. | |
| void | operator delete (void *ptr) |
| Custom operator delete for placement-new allocated instances. | |
| void | make_empty () |
| Reset the size to zero without freeing storage. | |
| bitvect & | operator= (const bitvect &other) |
| Copy-assignment operator. | |
| void | reserve_blocks (size_t new_block_count) |
| size_t | used_blocks () const |
| Return the number of blocks currently in use. | |
| size_t | size () const |
| Return the number of bits in the vector. | |
| size_t | capacity () const |
| Return the maximum number of bits the storage can hold. | |
| size_t | hash () const noexcept |
| Return a hash of the bit vector. | |
| bool | get (size_t pos) const |
| Return the value of bit pos. | |
| void | clear_all () |
| Clear all bits (set them to zero). | |
| bool | is_fully_clear () const |
| Return true iff all bits are zero. | |
| bool | is_fully_set () const |
| Return true iff all bits are set to one. | |
| void | set_all () |
| Set all bits to one. | |
| void | flip_all () |
| Flip all bits. | |
| void | set (size_t pos) |
| Set bit at position pos to one. | |
| void | clear (size_t pos) |
| Clear bit at position pos (set it to zero). | |
| void | flip (size_t pos) |
| Flip the bit at position pos. | |
| bitvect & | operator|= (const bitvect &other) |
| In-place bitwise OR with other. | |
| bitvect & | operator&= (const bitvect &other) |
| In-place bitwise AND with other. | |
| bitvect & | add_common (const bitvect &other1, const bitvect &other2) |
| OR into *this the bits common to other1 and other2. | |
| bool | intersects (const bitvect &other) |
| Return true if *this and other share any set bit. | |
| bitvect & | operator^= (const bitvect &other) |
| In-place bitwise XOR with other. | |
| bitvect & | operator-= (const bitvect &other) |
| Clear in *this the bits that are set in other. | |
| bool | is_subset_of (const bitvect &other) const |
| Return true if every set bit of *this is also set in other. | |
| unsigned | count () const |
| Return the number of set bits (popcount). | |
| bool | operator== (const bitvect &other) const |
| Equality comparison. | |
| bool | operator!= (const bitvect &other) const |
| Inequality comparison. | |
| bool | operator< (const bitvect &other) const |
| Lexicographic less-than comparison. | |
| bool | operator>= (const bitvect &other) const |
| Lexicographic greater-than-or-equal comparison. | |
| bool | operator> (const bitvect &other) const |
| Lexicographic greater-than comparison. | |
| bool | operator<= (const bitvect &other) const |
| Lexicographic less-than-or-equal comparison. | |
| template<typename F > | |
| void | foreach_set_index (F callback) const |
| Call callback with the index of each set bit. | |
Friends | |
| bitvect * | make_bitvect (size_t bitcount) |
| Allocate a bit-vector of bitcount bits. | |
| std::ostream & | operator<< (std::ostream &, const bitvect &) |
| Print a bitvect. | |
| bitvect_array * | make_bitvect_array (size_t bitcount, size_t vectcount) |
| Allocate vectcount bit-vectors of bitcount bits. | |
A bit vector.
| typedef unsigned long spot::bitvect::block_t |
Storage block type.
|
inline |
Copy constructor.
OR into *this the bits common to other1 and other2.
|
inline |
Return the maximum number of bits the storage can hold.
|
inline |
Clear bit at position pos (set it to zero).
|
inline |
Clear all bits (set them to zero).
| bitvect * spot::bitvect::clone | ( | ) | const |
Return a heap-allocated copy.
|
inline |
Return the number of set bits (popcount).
|
inline |
Flip the bit at position pos.
|
inline |
Flip all bits.
Call callback with the index of each set bit.
|
inline |
Return the value of bit pos.
|
noexcept |
Return a hash of the bit vector.
|
inline |
Return true if *this and other share any set bit.
|
inline |
Return true iff all bits are zero.
|
inline |
Return true iff all bits are set to one.
|
inline |
Return true if every set bit of *this is also set in other.
|
inline |
Reset the size to zero without freeing storage.
|
inline |
Custom operator delete for placement-new allocated instances.
|
inline |
Inequality comparison.
In-place bitwise AND with other.
Clear in *this the bits that are set in other.
|
inline |
Lexicographic less-than comparison.
References used_blocks().
|
inline |
Lexicographic less-than-or-equal comparison.
Copy-assignment operator.
References size().
|
inline |
Equality comparison.
References used_blocks().
|
inline |
Lexicographic greater-than comparison.
|
inline |
Lexicographic greater-than-or-equal comparison.
In-place bitwise XOR with other.
|
inline |
Grow the bitvector to new_block_count blocks.
This only changes the capacity of the bitvector, not its size.
|
inline |
Set bit at position pos to one.
|
inline |
Set all bits to one.
|
inline |
Return the number of bits in the vector.
Referenced by operator=().
|
inline |
Return the number of blocks currently in use.
Referenced by operator<(), and operator==().
|
friend |
Allocate a bit-vector of bitcount bits.
The resulting object should be released with delete.
|
friend |
Allocate vectcount bit-vectors of bitcount bits.
The resulting bitvect_array should be released with delete.
|
friend |
Print a bitvect.
1.9.8