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