dynamic_bitset 1.3.1
Simple Useful Libraries: C++17/20 header-only dynamic bitset
|
Simple Useful Libraries. More...
Classes | |
class | dynamic_bitset |
Dynamic bitset. More... | |
Functions | |
template<typename integral_type , typename = std::enable_if_t<std::is_integral_v<integral_type>>> | |
dynamic_bitset (integral_type) -> dynamic_bitset<> | |
template<typename Block , typename Allocator > | |
constexpr bool | operator!= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if two sul::dynamic_bitset content are different. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator<= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "less than or equal to" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator> (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "greater than" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator>= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "greater than or equal to" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator& (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary AND on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator| (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary OR on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator^ (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary XOR on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator- (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary difference between bits of lhs and rhs . | |
template<typename _CharT , typename _Traits , typename Block , typename Allocator > | |
constexpr std::basic_ostream< _CharT, _Traits > & | operator<< (std::basic_ostream< _CharT, _Traits > &os, const dynamic_bitset< Block, Allocator > &bitset) |
Insert a string representation of this sul::dynamic_bitset to a character stream. | |
template<typename _CharT , typename _Traits , typename Block , typename Allocator > | |
constexpr std::basic_istream< _CharT, _Traits > & | operator>> (std::basic_istream< _CharT, _Traits > &is, dynamic_bitset< Block, Allocator > &bitset) |
Extract a sul::dynamic_bitset from a character stream using its string representation. | |
template<typename Block , typename Allocator > | |
constexpr void | swap (dynamic_bitset< Block, Allocator > &bitset1, dynamic_bitset< Block, Allocator > &bitset2) noexcept(noexcept(bitset1.swap(bitset2))) |
Exchange the content of bitset1 and bitset2 . | |
template<typename Block_ , typename Allocator_ > | |
constexpr bool | operator== (const dynamic_bitset< Block_, Allocator_ > &lhs, const dynamic_bitset< Block_, Allocator_ > &rhs) |
template<typename Block_ , typename Allocator_ > | |
constexpr bool | operator< (const dynamic_bitset< Block_, Allocator_ > &lhs, const dynamic_bitset< Block_, Allocator_ > &rhs) |
template<typename Block , typename Allocator > | |
constexpr bool | operator!= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if two sul::dynamic_bitset content are different. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator<= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "less than or equal to" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator> (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "greater than" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr bool | operator>= (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Test if lhs is "greater than or equal to" rhs . The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size. | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator& (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary AND on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator| (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary OR on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator^ (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary XOR on corresponding pairs of bits of lhs and rhs . | |
template<typename Block , typename Allocator > | |
constexpr dynamic_bitset< Block, Allocator > | operator- (const dynamic_bitset< Block, Allocator > &lhs, const dynamic_bitset< Block, Allocator > &rhs) |
Performs binary difference between bits of lhs and rhs . | |
template<typename _CharT , typename _Traits , typename Block , typename Allocator > | |
constexpr std::basic_ostream< _CharT, _Traits > & | operator<< (std::basic_ostream< _CharT, _Traits > &os, const dynamic_bitset< Block, Allocator > &bitset) |
Insert a string representation of this sul::dynamic_bitset to a character stream. | |
template<typename _CharT , typename _Traits , typename Block , typename Allocator > | |
constexpr std::basic_istream< _CharT, _Traits > & | operator>> (std::basic_istream< _CharT, _Traits > &is, dynamic_bitset< Block, Allocator > &bitset) |
Extract a sul::dynamic_bitset from a character stream using its string representation. | |
template<typename Block , typename Allocator > | |
constexpr void | swap (dynamic_bitset< Block, Allocator > &bitset1, dynamic_bitset< Block, Allocator > &bitset2) noexcept(noexcept(bitset1.swap(bitset2))) |
Exchange the content of bitset1 and bitset2 . | |
Simple Useful Libraries.
|
constexpr |
Test if two sul::dynamic_bitset content are different.
Defined as:
see sul::dynamic_bitset::operator==() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
|
constexpr |
Performs binary AND on corresponding pairs of bits of lhs
and rhs
.
Defined as:
see sul::dynamic_bitset::operator&=() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
and rhs
|
constexpr |
Performs binary difference between bits of lhs
and rhs
.
Defined as:
see sul::dynamic_bitset::operator-=() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
and rhs
|
nodiscardconstexpr |
The size comparison is necessary for the comparison operators to keep their properties. For example without the size comparison the "<=" operator (defined for "A <= B" by "!(B < A)") would no longer be antisymmetric (if A <= B and B <= A, then A == B) because operator==() compare the sul::dynamic_bitset as a container and not a number. For example with bitsets A(0011) and B(011), without the size comparison B < A would be false, A <= B would be true, B <= A would be true, but A == B would be false, breaking the antisymmetric property of the operator. Thus, to respect the properties of the operators, the size is used as a secondary criteria for the comparison of sul::dynamic_bitset which content represent the same number. Therefore, for the previous example with bitsets A(0011) and B(011), B < A is true, A <= B is false, B <= A is true and A == B is false.
If comparing bitsets A and B with the content of A representing the number a, and the content of B representing the number b, this operator would work as follow:
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block_ | Block type used by lhs and rhs for storing the bits |
Allocator_ | Allocator type used by lhs and rhs for memory management |
lhs
is "less than" rhs
|
constexpr |
Insert a string representation of this sul::dynamic_bitset to a character stream.
The string representation written is the same as if generated with sul::dynamic_bitset::to_string() with default parameter, using '1' for true bits and '0' for false bits.
os | Character stream to write to | |
[in] | bitset | sul::dynamic_bitset to write |
_CharT | Character type of the character stream |
_Traits | Traits class specifying the operations on the character type of the character stream |
Block | Block type used by bitset for storing the bits |
Allocator | Allocator type used by bitset for memory management |
os
|
constexpr |
Test if lhs
is "less than or equal to" rhs
. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
Defined as:
see sul::dynamic_bitset::operator<() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
is "less than or equal to" rhs
|
nodiscardconstexpr |
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block_ | Block type used by lhs and rhs for storing the bits |
Allocator_ | Allocator type used by lhs and rhs for memory management |
|
constexpr |
Test if lhs
is "greater than" rhs
. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
Defined as:
see sul::dynamic_bitset::operator<() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
is "greater than" rhs
|
constexpr |
Test if lhs
is "greater than or equal to" rhs
. The comparison of the two sul::dynamic_bitset is first on numbers their content represent and then on their size.
Defined as:
see sul::dynamic_bitset::operator<() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
is "greater than or equal to" rhs
|
constexpr |
Extract a sul::dynamic_bitset from a character stream using its string representation.
The string representation expected is the same as if generated with sul::dynamic_bitset::to_string() with default parameter, using '1' for true bits and '0' for false bits. On success the content of bitset
is cleared before writing to it. The extraction starts by skipping leading whitespace then take the characters one by one and stop if is.good()
return false or the next character is neither _CharT('0') nor _CharT('1').
is | Character stream to read from |
bitset | sul::dynamic_bitset to write to |
_CharT | Character type of the character stream |
_Traits | Traits class specifying the operations on the character type of the character stream |
Block | Block type used by bitset for storing the bits |
Allocator | Allocator type used by bitset for memory management |
is
|
constexpr |
Performs binary XOR on corresponding pairs of bits of lhs
and rhs
.
Defined as:
see sul::dynamic_bitset::operator^=() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
and rhs
|
constexpr |
Performs binary OR on corresponding pairs of bits of lhs
and rhs
.
Defined as:
see sul::dynamic_bitset::operator|=() for more informations.
[in] | lhs | The left hand side sul::dynamic_bitset of the operator |
[in] | rhs | The right hand side sul::dynamic_bitset of the operator |
Block | Block type used by lhs and rhs for storing the bits |
Allocator | Allocator type used by lhs and rhs for memory management |
lhs
and rhs
|
constexprnoexcept |
Exchange the content of bitset1
and bitset2
.
Defined as:
see sul::dynamic_bitset::swap() for more informations.
bitset1 | sul::dynamic_bitset to be swapped |
bitset2 | sul::dynamic_bitset to be swapped |
Block | Block type used by bitset for storing the bits |
Allocator | Allocator type used by bitset for memory management |