boost::dynamic_bitset
The dynamic_bitset template represents a set of bits.
Synopsis
Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>
template<
typename Block = unsigned long,
typename AllocatorOrContainer = std::allocator<Block>>
class dynamic_bitset;
Template parameters
‐ Block The integer type in which the bits are stored. Defaults to unsigned long.
‐ AllocatorOrContainer Either an allocator (to use for all internal memory management) or a container of Block's. Defaults to std::allocator< Block >.
Concepts modeled
DefaultConstructible, CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable, EqualityComparable, LessThanComparable.
Type requirements
Block is a cv‐unqualified unsigned integer type other than bool. AllocatorOrContainer satisfies the standard requirements for an allocator or is a container‐like type which provides at least bidirectional iterators.
Types
Name |
Description |
A proxy class to simulate lvalues of bit type. |
|
Optional zero‐copy serialization support. |
|
The allocator used for all memory allocations. |
|
The same type as |
|
A read‐only iterator into the bitset. |
|
The type bool. |
|
A reverse read‐only iterator into the bitset. |
|
A read/write iterator into the bitset. |
|
A reverse read/write reverse iterator into the bitset. |
|
An unsigned integral type that can represent the size of the bitset. See |
Member Functions
Name |
Description |
|
Constructors |
|
Destructor. |
Assignment operators |
|
Checks whether all bits in |
|
Checks whether any bits in |
|
|
|
A checked version of |
|
|
|
Returns the total number of elements that |
|
Returns a read‐only iterator that refers to the least significant bit in the bitset. |
|
Returns a read‐only iterator that refers to one past the most significant bit in the bitset. |
|
Clears the bitset, i.e. makes its size zero. |
|
Returns the number of bits in this bitset that are set. |
|
Returns a read‐only reverse iterator that refers to the most significant bit in the bitset. |
|
Returns a read‐only reverse iterator that refers to one before the least significant bit in the bitset. |
|
Checks whether this bitset has size zero. |
|
|
|
Finds the first set bit in |
|
Finds the first unset bit in |
|
Finds the first bit set in |
|
Finds the first unset bit in |
|
|
|
Returns a copy of the allocator object used to construct |
|
Checks whether |
|
Checks whether |
|
Checks whether |
|
Returns the maximum size of a bitset of this type. |
|
Checks whether this bitset has no set bit. |
|
Returns the number of blocks in this bitset. |
|
Bitwise‐ANDs all the bits in this bitset with the bits in |
|
Computes the set difference of this bitset and the |
|
Shifts the bits in this bitset to the left by |
|
Returns a shifted copy of |
|
Shifts the bits in this bitset to the right by |
|
Subscript operators |
|
Bitwise‐XORs all the bits in this bitset with the bits in |
|
Bitwise‐ORs all the bits in this bitset with the bits in |
|
Returns a copy of |
|
Decreases the size of the bitset by one, removing the most significant bit. |
|
Decreases the size of the bitset by one, removing the least significant bit. |
|
Increases the size of the bitset by one, and sets the value of the new most significant bit to |
|
Increases the size of the bitset by one, and sets the value of the new least significant bit to |
|
|
|
|
|
Informs the bitset of a planned change in size, so that it can manage the storage allocation accordingly. |
|
|
|
Changes the number of bits of the bitset to |
|
|
|
Requests the bitset to reduce memory use by removing unused capacity. |
|
Returns the number of bits in this bitset. |
|
Swaps the contents of this bitset and bitset |
|
Tests the bit at the given position. |
|
Sets bit |
|
Returns the numeric value corresponding to the bits in |
|
Returns a shifted copy of |
Static Data Members
Name |
Description |
The number of bits the type |
|
The maximum value of |
Friends
| Name | Description |
|---|---|
|
|
Optional zero‐copy serialization support. |
|
Computes a hash value for a |
|
|
|
Less‐than operator |
|
Equality operator |
|
|
|
|
Non-Member Functions
Name |
Description |
Compares two bitsets. |
|
Performs a bitwise‐AND of two bitsets. |
|
Calculates the set difference of two bitsets. |
|
Compares two bitsets. |
|
Compares two bitsets. |
|
Compares two bitsets. |
|
Compares two bitsets. |
|
Compares two bitsets. |
|
Performs a bitwise‐XOR of two bitsets. |
|
Performs a bitwise‐OR of two bitsets. |
|
Exchanges the contents of |
|
Writes the bits of the bitset into the iterator |
|
Copies a representation of |
Created with MrDocs