Bitcoin Core 28.99.0
P2P Digital Currency
|
A bitset implementation backed by N integers of type I. More...
#include <bitset.h>
Classes | |
class | Iterator |
Iterator type returned by begin(), which efficiently iterates all 1 positions. More... | |
class | IteratorEnd |
Dummy type to return using end(). More... | |
Public Member Functions | |
constexpr | MultiIntBitSet () noexcept |
Construct an all-zero bitset. More... | |
constexpr | MultiIntBitSet (const MultiIntBitSet &) noexcept=default |
Copy construct a bitset. More... | |
constexpr MultiIntBitSet & | operator= (const MultiIntBitSet &) noexcept=default |
Copy assign a bitset. More... | |
void constexpr | Set (unsigned pos) noexcept |
Set a bit to 1. More... | |
void constexpr | Set (unsigned pos, bool val) noexcept |
Set a bit to the specified value. More... | |
constexpr | MultiIntBitSet (std::initializer_list< unsigned > ilist) noexcept |
Construct a bitset from a list of values. More... | |
constexpr MultiIntBitSet & | operator= (std::initializer_list< unsigned > ilist) noexcept |
Set a bitset to a list of values. More... | |
void constexpr | Reset (unsigned pos) noexcept |
Set a bit to 0. More... | |
bool constexpr | operator[] (unsigned pos) const noexcept |
Retrieve a bit at the given position. More... | |
unsigned constexpr | Count () const noexcept |
Compute the number of 1 bits in the bitset. More... | |
bool constexpr | None () const noexcept |
Check if all bits are 0. More... | |
bool constexpr | Any () const noexcept |
Check if any bits are 1. More... | |
Iterator constexpr | begin () const noexcept |
Return an object that iterates over all 1 bits (++ and * only allowed when != end()). More... | |
IteratorEnd constexpr | end () const noexcept |
Return a dummy object to compare Iterators with. More... | |
unsigned constexpr | First () const noexcept |
Find the first element (requires Any()). More... | |
unsigned constexpr | Last () const noexcept |
Find the last element (requires Any()). More... | |
constexpr MultiIntBitSet & | operator|= (const MultiIntBitSet &a) noexcept |
Set this object's bits to be the binary OR between respective bits from this and a. More... | |
constexpr MultiIntBitSet & | operator&= (const MultiIntBitSet &a) noexcept |
Set this object's bits to be the binary AND between respective bits from this and a. More... | |
constexpr MultiIntBitSet & | operator-= (const MultiIntBitSet &a) noexcept |
Set this object's bits to be the binary AND NOT between respective bits from this and a. More... | |
constexpr MultiIntBitSet & | operator^= (const MultiIntBitSet &a) noexcept |
Set this object's bits to be the binary XOR between respective bits from this and a. More... | |
constexpr bool | Overlaps (const MultiIntBitSet &a) const noexcept |
Check whether the intersection between two sets is non-empty. More... | |
constexpr bool | IsSupersetOf (const MultiIntBitSet &a) const noexcept |
Check if bitset a is a superset of bitset b (= every 1 bit in b is also in a). More... | |
constexpr bool | IsSubsetOf (const MultiIntBitSet &a) const noexcept |
Check if bitset a is a subset of bitset b (= every 1 bit in a is also in b). More... | |
Static Public Member Functions | |
static constexpr MultiIntBitSet | Singleton (unsigned pos) noexcept |
Construct a bitset with the singleton pos. More... | |
static constexpr MultiIntBitSet | Fill (unsigned count) noexcept |
Construct a bitset with bits 0..count-1 (inclusive) set to 1. More... | |
static constexpr unsigned | Size () noexcept |
Return the number of bits that this object holds. More... | |
Private Attributes | |
std::array< I, N > | m_val |
Array whose member integers store the bits of the set. More... | |
Static Private Attributes | |
static constexpr unsigned | LIMB_BITS = std::numeric_limits<I>::digits |
The number of bits per integer. More... | |
static constexpr unsigned | MAX_SIZE = LIMB_BITS * N |
Number of elements this set type supports. More... | |
Friends | |
constexpr MultiIntBitSet | operator& (const MultiIntBitSet &a, const MultiIntBitSet &b) noexcept |
Return an object with the binary AND between respective bits from a and b. More... | |
constexpr MultiIntBitSet | operator| (const MultiIntBitSet &a, const MultiIntBitSet &b) noexcept |
Return an object with the binary OR between respective bits from a and b. More... | |
constexpr MultiIntBitSet | operator- (const MultiIntBitSet &a, const MultiIntBitSet &b) noexcept |
Return an object with the binary AND NOT between respective bits from a and b. More... | |
constexpr MultiIntBitSet | operator^ (const MultiIntBitSet &a, const MultiIntBitSet &b) noexcept |
Return an object with the binary XOR between respective bits from a and b. More... | |
constexpr bool | operator== (const MultiIntBitSet &a, const MultiIntBitSet &b) noexcept=default |
Check if bitset a and bitset b are identical. More... | |
constexpr void | swap (MultiIntBitSet &a, MultiIntBitSet &b) noexcept |
Swap two bitsets. More... | |
A bitset implementation backed by N integers of type I.
|
inlineconstexprnoexcept |
|
constexprdefaultnoexcept |
Copy construct a bitset.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
constexprdefaultnoexcept |
Copy assign a bitset.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
friend |
|
friend |
|
friend |
Check if bitset a and bitset b are identical.
|
friend |
|
friend |
|
friend |
|
staticconstexprprivate |
|
private |
|
staticconstexprprivate |