dynamic_bitset
|
A dynamic bitset implementation that can be resized at runtime. More...
#include <dynamic_bitset.hpp>
Public Member Functions | |
dynamic_bitset () | |
Default constructor that initializes the bitset with the default size. More... | |
dynamic_bitset (int value) | |
Constructor that initializes the bitset with a given integer value. More... | |
dynamic_bitset (std::vector< bool > binaries) | |
Constructor that initializes the bitset with a vector of bools. More... | |
dynamic_bitset (std::initializer_list< bool > binaries) | |
Constructor that initializes the bitset with an initializer list of bools. More... | |
dynamic_bitset (const std::string &binary_string) | |
Constructor that initializes the bitset with a string of binary digits. More... | |
dynamic_bitset (const char *binary) | |
Constructor that initializes the bitset with a C-style string of binary digits. More... | |
~dynamic_bitset () | |
Destructor for dynamic_bitset. More... | |
dynamic_bitset (const dynamic_bitset &)=delete | |
Delete the copy constructor for dynamic_bitset. More... | |
dynamic_bitset & | operator= (const dynamic_bitset &)=delete |
Delete the copy assignment operator for dynamic_bitset. More... | |
dynamic_bitset (dynamic_bitset &&other) | |
Move constructor for dynamic_bitset. More... | |
dynamic_bitset & | operator= (dynamic_bitset &&other) |
Move assignment operator for dynamic_bitset. More... | |
dynamic_bitset & | operator= (const std::vector< bool > &binaries) |
Assignment operator to assign a std::vector<bool> to dynamic_bitset. More... | |
dynamic_bitset & | reverse () |
Reverse the bits in dynamic_bitset. More... | |
const std::vector< bool > & | get () const |
Get the underlying std::vector<bool> object. More... | |
bool | operator[] (std::size_t index) const |
Get the value of a bit at a given index. More... | |
bool | all () const |
Check if all bits in dynamic_bitset are true. More... | |
bool | any () const |
Check if any bit in dynamic_bitset is true. More... | |
bool | none () const |
Check if none of the bits in dynamic_bitset are true. More... | |
std::vector< bool >::reference | operator[] (std::size_t index) |
Return reference bit on the given index. More... | |
constexpr std::size_t | size () const |
Return size of the bitset. More... | |
dynamic_bitset & | set (bool value) |
Set all value of the bitset. More... | |
dynamic_bitset & | reset () |
Set all value to 0. More... | |
std::string | to_string () const |
convert bitset to string bitset More... | |
operator std::string () const | |
string casting operator, return bitset to string More... | |
std::size_t | to_ulong () const |
bitset to std::size_t More... | |
operator std::size_t () const | |
casting operator of std::size_t More... | |
operator unsigned long const () | |
casting operator of unsigned long More... | |
operator unsigned long long const () | |
casting operator of unsigned long long More... | |
dynamic_bitset | operator& (const dynamic_bitset &other) const |
and operator between two dynamic_bitset More... | |
dynamic_bitset & | operator&= (const dynamic_bitset &other) |
and operator between two dynamic_bitset and change orginal set More... | |
dynamic_bitset | operator| (const dynamic_bitset &other) const |
or operator between two dynamic_bitset More... | |
dynamic_bitset & | operator|= (const dynamic_bitset &other) |
or operator between two dynamic_bitset and change orginal set More... | |
dynamic_bitset | operator^ (const dynamic_bitset &other) const |
xor operator between two dynamic_bitset More... | |
dynamic_bitset & | operator^= (const dynamic_bitset &other) |
xor operator between two dynamic_bitset and change orginal set More... | |
dynamic_bitset & | operator<<= (std::size_t shift_amount) |
Left Shift operator. More... | |
dynamic_bitset & | operator>>= (std::size_t shift_amount) |
Right Shift operator. More... | |
std::vector< bool >::iterator | begin () |
begin iterator More... | |
std::vector< bool >::iterator | end () |
begin iterator More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const dynamic_bitset &set) |
ostream operator to print dynamic_bitset More... | |
std::istream & | operator>> (std::istream &input, dynamic_bitset &set) |
istream operator to input of dynamic_bitset More... | |
A dynamic bitset implementation that can be resized at runtime.
The dynamic_bitset class provides a simple implementation of a bitset that can be resized at runtime. It supports all the basic bit operations, such as AND, OR, NOT, and XOR, as well as various other functions such as reverse, to_string, and to_ulong.
N | The default size of the bitset. If no size is specified, the bitset will be empty and ready for dynamic usage. |
Definition at line 24 of file dynamic_bitset.hpp.
|
inline |
Default constructor that initializes the bitset with the default size.
Definition at line 30 of file dynamic_bitset.hpp.
|
inline |
Constructor that initializes the bitset with a given integer value.
value | The integer value to initialize the bitset with. |
Definition at line 37 of file dynamic_bitset.hpp.
|
inline |
Constructor that initializes the bitset with a vector of bools.
binaries | The vector of bools to initialize the bitset with. |
Definition at line 49 of file dynamic_bitset.hpp.
|
inline |
Constructor that initializes the bitset with an initializer list of bools.
binaries | The initializer list of bools to initialize the bitset with. |
Definition at line 62 of file dynamic_bitset.hpp.
|
inline |
Constructor that initializes the bitset with a string of binary digits.
binary_string | The string of binary digits to initialize the bitset with. |
Definition at line 75 of file dynamic_bitset.hpp.
|
inline |
Constructor that initializes the bitset with a C-style string of binary digits.
binary | The C-style string of binary digits to initialize the bitset with. |
Definition at line 86 of file dynamic_bitset.hpp.
|
inline |
Destructor for dynamic_bitset.
Definition at line 100 of file dynamic_bitset.hpp.
|
delete |
Delete the copy constructor for dynamic_bitset.
|
inline |
Move constructor for dynamic_bitset.
other | The dynamic_bitset object to move from. |
Definition at line 116 of file dynamic_bitset.hpp.
|
delete |
Delete the copy assignment operator for dynamic_bitset.
|
inline |
Move assignment operator for dynamic_bitset.
other | The dynamic_bitset object to move from. |
Definition at line 123 of file dynamic_bitset.hpp.
|
inline |
Assignment operator to assign a std::vector<bool> to dynamic_bitset.
binaries | The std::vector<bool> to assign. |
Definition at line 136 of file dynamic_bitset.hpp.
|
inline |
Reverse the bits in dynamic_bitset.
Definition at line 148 of file dynamic_bitset.hpp.
|
inline |
Get the underlying std::vector<bool> object.
Definition at line 158 of file dynamic_bitset.hpp.
|
inline |
Get the value of a bit at a given index.
index | The index of the bit. |
Definition at line 165 of file dynamic_bitset.hpp.
|
inline |
Check if all bits in dynamic_bitset are true.
Definition at line 171 of file dynamic_bitset.hpp.
|
inline |
Check if any bit in dynamic_bitset is true.
Definition at line 180 of file dynamic_bitset.hpp.
|
inline |
Check if none of the bits in dynamic_bitset are true.
Definition at line 189 of file dynamic_bitset.hpp.
|
inline |
Return reference bit on the given index.
Definition at line 198 of file dynamic_bitset.hpp.
|
inlineconstexpr |
Return size of the bitset.
Definition at line 206 of file dynamic_bitset.hpp.
|
inline |
Set all value of the bitset.
Definition at line 212 of file dynamic_bitset.hpp.
|
inline |
Set all value to 0.
Definition at line 221 of file dynamic_bitset.hpp.
|
inline |
convert bitset to string bitset
Definition at line 227 of file dynamic_bitset.hpp.
|
inline |
string casting operator, return bitset to string
Definition at line 239 of file dynamic_bitset.hpp.
|
inline |
bitset to std::size_t
Definition at line 246 of file dynamic_bitset.hpp.
|
inline |
casting operator of std::size_t
Definition at line 261 of file dynamic_bitset.hpp.
|
inline |
casting operator of unsigned long
Definition at line 267 of file dynamic_bitset.hpp.
|
inline |
casting operator of unsigned long long
Definition at line 276 of file dynamic_bitset.hpp.
|
inline |
and operator between two dynamic_bitset
Definition at line 285 of file dynamic_bitset.hpp.
|
inline |
and operator between two dynamic_bitset and change orginal set
Definition at line 298 of file dynamic_bitset.hpp.
|
inline |
or operator between two dynamic_bitset
Definition at line 309 of file dynamic_bitset.hpp.
|
inline |
or operator between two dynamic_bitset and change orginal set
Definition at line 322 of file dynamic_bitset.hpp.
|
inline |
xor operator between two dynamic_bitset
Definition at line 334 of file dynamic_bitset.hpp.
|
inline |
xor operator between two dynamic_bitset and change orginal set
Definition at line 346 of file dynamic_bitset.hpp.
|
inline |
Left Shift operator.
shift_amount,amount | of the shift that will used for left shifting |
Definition at line 359 of file dynamic_bitset.hpp.
|
inline |
Right Shift operator.
shift_amount,amount | of the shift that will used for right shifting |
Definition at line 378 of file dynamic_bitset.hpp.
|
inline |
begin iterator
Definition at line 396 of file dynamic_bitset.hpp.
|
inline |
begin iterator
Definition at line 402 of file dynamic_bitset.hpp.
|
friend |
ostream operator to print dynamic_bitset
Definition at line 409 of file dynamic_bitset.hpp.
|
friend |
istream operator to input of dynamic_bitset
Definition at line 422 of file dynamic_bitset.hpp.