container of bits More...
#include <MRBitSet.h>
Public Types | |
using | base = boost::dynamic_bitset<std::uint64_t> |
using | IndexType = size_t |
Public Member Functions | |
BitSet (size_t numBits, bool fillValue) | |
creates bitset of given size filled with given value | |
bool | test (IndexType n) const |
bool | test_set (IndexType n, bool val=true) |
BitSet & | set (IndexType n, size_type len, bool val) |
BitSet & | set (IndexType n, bool val=true) |
BitSet & | set () |
BitSet & | reset (IndexType n, size_type len) |
BitSet & | reset (IndexType n) |
BitSet & | reset () |
BitSet & | flip (IndexType n, size_type len) |
BitSet & | flip (IndexType n) |
BitSet & | flip () |
const auto & | bits () const |
read-only access to all bits stored as a vector of uint64 blocks | |
MRMESH_API BitSet & | operator&= (const BitSet &b) |
MRMESH_API BitSet & | operator|= (const BitSet &b) |
MRMESH_API BitSet & | operator^= (const BitSet &b) |
MRMESH_API BitSet & | operator-= (const BitSet &b) |
MRMESH_API BitSet & | subtract (const BitSet &b, int bShiftInBlocks) |
subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block | |
MRMESH_API IndexType | find_last () const |
return the highest index i such as bit i is set, or npos if *this has no on bits. | |
MRMESH_API size_t | nthSetBit (size_t n) const |
returns the location of nth set bit (where the first bit corresponds to n=0) or npos if there are less bit set | |
void | resizeWithReserve (size_t newSize) |
doubles reserved memory until resize(newSize) can be done without reallocation | |
void | autoResizeSet (size_t pos, size_type len, bool val=true) |
sets elements [pos, pos+len) to given value, adjusting the size of the set to include new elements | |
void | autoResizeSet (size_t pos, bool val=true) |
bool | autoResizeTestSet (size_t pos, bool val=true) |
same as autoResizeSet and returns previous value of pos-bit | |
size_t | heapBytes () const |
returns the amount of memory this object occupies on heap | |
IndexType | backId () const |
returns the identifier of the back() element | |
IndexType | endId () const |
Static Public Member Functions | |
static IndexType | beginId () |
[beginId(), endId()) is the range of all bits in the set | |
container of bits
using MR::BitSet::base = boost::dynamic_bitset<std::uint64_t> |
using MR::BitSet::IndexType = size_t |
|
inlineexplicit |
creates bitset of given size filled with given value
|
inline |
|
inline |
sets elements [pos, pos+len) to given value, adjusting the size of the set to include new elements
|
inlinenodiscard |
same as autoResizeSet and returns previous value of pos-bit
|
inlinenodiscard |
returns the identifier of the back() element
|
inlinestaticnodiscard |
|
inline |
read-only access to all bits stored as a vector of uint64 blocks
|
inlinenodiscard |
|
nodiscard |
return the highest index i such as bit i is set, or npos if *this has no on bits.
|
inline |
|
inlinenodiscard |
returns the amount of memory this object occupies on heap
|
nodiscard |
returns the location of nth set bit (where the first bit corresponds to n=0) or npos if there are less bit set
MRMESH_API BitSet & MR::BitSet::operator&= | ( | const BitSet & | b | ) |
MRMESH_API BitSet & MR::BitSet::operator-= | ( | const BitSet & | b | ) |
MRMESH_API BitSet & MR::BitSet::operator^= | ( | const BitSet & | b | ) |
MRMESH_API BitSet & MR::BitSet::operator|= | ( | const BitSet & | b | ) |
|
inline |
|
inline |
doubles reserved memory until resize(newSize) can be done without reallocation
|
inline |
MRMESH_API BitSet & MR::BitSet::subtract | ( | const BitSet & | b, |
int | bShiftInBlocks ) |
subtracts b from this, considering that bits in b are shifted right on bShiftInBlocks*bits_per_block
|
inlinenodiscard |
|
inlinenodiscard |