SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
A constexpr bitset implementation with dynamic size at compile time. More...
#include <seqan3/utility/container/dynamic_bitset.hpp>
Public Types | |
Associated types | |
using | value_type = bool |
Equals bool . | |
using | reference = reference_proxy_type |
A proxy type that enables assignment. | |
using | const_reference = bool |
Equals the value_type. | |
using | iterator = detail::random_access_iterator< dynamic_bitset > |
The iterator type of this container (a random access iterator). | |
using | const_iterator = detail::random_access_iterator< dynamic_bitset const > |
The const_iterator type of this container (a random access iterator). | |
using | difference_type = ptrdiff_t |
A std::ptrdiff_t . | |
using | size_type = detail::min_viable_uint_t< bit_capacity > |
An unsigned integer type (usually std::size_t ). | |
Public Member Functions | |
Constructors, destructor and assignment | |
constexpr | dynamic_bitset () noexcept=default |
Defaulted. | |
constexpr | dynamic_bitset (dynamic_bitset const &) noexcept=default |
Defaulted. | |
constexpr | dynamic_bitset (dynamic_bitset &&) noexcept=default |
Defaulted. | |
constexpr dynamic_bitset & | operator= (dynamic_bitset const &) noexcept=default |
Defaulted. | |
constexpr dynamic_bitset & | operator= (dynamic_bitset &&) noexcept=default |
Defaulted. | |
~dynamic_bitset () noexcept=default | |
Defaulted. | |
constexpr | dynamic_bitset (uint64_t const value) |
Construct from an uint64_t . | |
template<std::forward_iterator begin_it_type, typename end_it_type > requires std::sentinel_for<end_it_type, begin_it_type> && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>> | |
constexpr | dynamic_bitset (begin_it_type begin_it, end_it_type end_it) noexcept |
Construct from two iterators. | |
template<std::ranges::input_range other_range_t> requires (!std::same_as<std::remove_cvref_t<other_range_t>, dynamic_bitset>) | |
constexpr | dynamic_bitset (other_range_t &&range) noexcept |
Construct from a different range. | |
constexpr | dynamic_bitset (size_type const n, value_type const value) noexcept |
Construct with n times value . | |
constexpr dynamic_bitset & | operator= (std::initializer_list< value_type > const ilist) noexcept |
Assign from std::initializer_list . | |
template<size_t N> | |
constexpr | dynamic_bitset (char const (&lit)[N]) |
Construction from literal. | |
template<size_t N> | |
constexpr dynamic_bitset & | operator= (char const (&lit)[N]) |
Assign from literal. | |
template<size_t N> | |
constexpr void | assign (char const (&lit)[N]) |
Assign from literal. | |
constexpr void | assign (std::initializer_list< value_type > const ilist) noexcept |
Assign from std::initializer_list . | |
constexpr void | assign (size_type const count, value_type const value) noexcept |
Assign with count times value . | |
template<std::ranges::input_range other_range_t> requires std::constructible_from<value_type, std::ranges::range_reference_t<other_range_t>> | |
constexpr void | assign (other_range_t &&range) noexcept |
Assign from a different range. | |
template<std::forward_iterator begin_it_type, typename end_it_type > requires std::sentinel_for<end_it_type, begin_it_type> && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>> | |
constexpr void | assign (begin_it_type begin_it, end_it_type end_it) noexcept |
Assign from pair of iterators. | |
Iterators | |
constexpr iterator | begin () noexcept |
Returns the begin to the dynamic_bitset . | |
constexpr const_iterator | begin () const noexcept |
Returns the begin to the dynamic_bitset . | |
constexpr const_iterator | cbegin () const noexcept |
Returns the begin to the dynamic_bitset . | |
constexpr iterator | end () noexcept |
Returns iterator past the end of the dynamic_bitset . | |
constexpr const_iterator | end () const noexcept |
Returns iterator past the end of the dynamic_bitset . | |
constexpr const_iterator | cend () const noexcept |
Returns iterator past the end of the dynamic_bitset . | |
Bit manipulation | |
constexpr dynamic_bitset & | operator&= (dynamic_bitset const &rhs) noexcept |
Sets the bits to the result of binary AND on corresponding pairs of bits of *this and rhs . | |
constexpr dynamic_bitset & | operator|= (dynamic_bitset const &rhs) noexcept |
Sets the bits to the result of binary OR on corresponding pairs of bits of *this and rhs . | |
constexpr dynamic_bitset & | operator^= (dynamic_bitset const &rhs) noexcept |
Sets the bits to the result of binary XOR on corresponding pairs of bits of *this and rhs . | |
constexpr dynamic_bitset | operator~ () const noexcept |
Returns a temporary copy of *this with all bits flipped (binary NOT). | |
constexpr dynamic_bitset & | operator<<= (size_t const count) noexcept |
Performs binary shift left on the current object. | |
constexpr dynamic_bitset & | operator>>= (size_t const count) noexcept |
Performs binary shift right on the current object. | |
constexpr dynamic_bitset | operator>> (size_t const count) const noexcept |
Performs binary shift right. | |
constexpr dynamic_bitset | operator<< (size_t const count) const noexcept |
Performs binary shift left. | |
constexpr dynamic_bitset & | set () noexcept |
Sets all bits to 1 . | |
constexpr dynamic_bitset & | set (size_t const i, bool const value=true) |
Sets the i'th bit to value . | |
constexpr dynamic_bitset & | reset () noexcept |
Sets all bits to 0 . | |
constexpr dynamic_bitset & | reset (size_t const i) |
Sets the i'th bit to false. | |
constexpr dynamic_bitset & | flip () noexcept |
Flips all bits (binary NOT). | |
constexpr dynamic_bitset & | flip (size_t const i) |
Flips the i'th bit (binary NOT). | |
Element Access | |
constexpr bool | all () const noexcept |
Checks if all bit are set. | |
constexpr bool | any () const noexcept |
Checks if any bit is set. | |
constexpr bool | none () const noexcept |
Checks if no bit is set. | |
constexpr size_type | count () const noexcept |
Returns the number of set bits. | |
constexpr reference | at (size_t const i) |
Returns the i-th element. | |
constexpr const_reference | at (size_t const i) const |
Returns the i-th element. | |
constexpr const_reference | test (size_t const i) const |
Returns the i-th element. | |
constexpr reference | operator[] (size_t const i) noexcept |
Returns the i-th element. | |
constexpr const_reference | operator[] (size_t const i) const noexcept |
Returns the i-th element. | |
constexpr reference | front () noexcept |
Returns the first element. | |
constexpr const_reference | front () const noexcept |
Returns the first element. | |
constexpr reference | back () noexcept |
Returns the last element. | |
constexpr const_reference | back () const noexcept |
Returns the last element. | |
constexpr bitfield * | raw_data () noexcept |
Direct access to the underlying bit field. | |
constexpr bitfield const * | raw_data () const noexcept |
Direct access to the underlying bit field. | |
Capacity | |
constexpr bool | empty () const noexcept |
Checks whether the container is empty. | |
constexpr size_type | size () const noexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end()) . | |
constexpr size_type | max_size () const noexcept |
Returns the maximum number of elements the container is able to hold and resolves to bit_capacity . | |
constexpr size_type | capacity () const noexcept |
Returns the number of elements that the container is able to hold and resolves to bit_capacity . | |
constexpr void | reserve (size_t) const noexcept |
Since the capacity is fixed on compile time, this is a no-op. | |
constexpr void | shrink_to_fit () const noexcept |
Since the capacity is fixed on compile time, this is a no-op. | |
Modifiers | |
constexpr void | clear () noexcept |
Removes all elements from the container. | |
constexpr iterator | insert (const_iterator pos, value_type const value) noexcept |
Inserts value before pos in the container. | |
constexpr iterator | insert (const_iterator pos, size_type const count, value_type const value) noexcept |
Inserts count copies of value before position in the container. | |
template<std::forward_iterator begin_it_type, typename end_it_type > requires std::sentinel_for<end_it_type, begin_it_type> && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>> | |
constexpr iterator | insert (const_iterator pos, begin_it_type begin_it, end_it_type end_it) noexcept |
Inserts elements from range [begin_it, end_it) before pos in the container. | |
constexpr iterator | insert (const_iterator pos, std::initializer_list< value_type > const &ilist) noexcept |
Inserts elements from initializer list before pos in the container. | |
constexpr iterator | erase (const_iterator begin_it, const_iterator end_it) noexcept |
Removes specified elements from the container. | |
constexpr iterator | erase (const_iterator pos) noexcept |
Removes specified elements from the container. | |
constexpr void | push_back (value_type const value) noexcept |
Appends the given element value to the end of the container. | |
constexpr void | pop_back () noexcept |
Removes the last element of the container. | |
constexpr void | resize (size_type const count, value_type const value=false) noexcept |
Resizes the container to contain count elements. | |
constexpr void | swap (dynamic_bitset &rhs) noexcept |
Swap contents with another instance. | |
constexpr void | swap (dynamic_bitset &&rhs) noexcept |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Conversions | |
template<typename char_t = char> | |
std::string | to_string (char_t zero=char_t{ '0'}, char_t one=char_t{ '1'}) const |
Converts the dynamic_bitset to a std::string . | |
constexpr unsigned long | to_ulong () const |
Converts the dynamic_bitset to an unsigned long integer. | |
constexpr unsigned long long | to_ullong () const |
Converts the dynamic_bitset to an unsigned long long integer. | |
Friends | |
template<size_t > | |
class | dynamic_bitset |
Befriend other template instantiations of dynamic_bitset. | |
constexpr void | swap (dynamic_bitset &lhs, dynamic_bitset &rhs) noexcept |
Swap contents with another instance. | |
Binary operators | |
template<size_t cap> requires (cap <= bit_capacity) | |
constexpr dynamic_bitset | operator& (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Returns dynamic_bitset containing the result of binary AND on corresponding pairs of bits of lhs and rhs . | |
template<size_t cap> requires (cap <= bit_capacity) | |
constexpr dynamic_bitset | operator^ (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Returns dynamic_bitset containing the result of binary XOR on corresponding pairs of bits of lhs and rhs . | |
template<size_t cap> requires (cap <= bit_capacity) | |
constexpr dynamic_bitset | operator| (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Returns dynamic_bitset containing the result of binary OR on corresponding pairs of bits of lhs and rhs . | |
Comparison operators | |
template<size_t cap> | |
constexpr bool | operator== (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
template<size_t cap> | |
constexpr bool | operator!= (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
template<size_t cap> | |
constexpr bool | operator< (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
template<size_t cap> | |
constexpr bool | operator> (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
template<size_t cap> | |
constexpr bool | operator<= (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
template<size_t cap> | |
constexpr bool | operator>= (dynamic_bitset const &lhs, dynamic_bitset< cap > const &rhs) noexcept |
Performs element-wise comparison. | |
Input/output | |
std::ostream & | operator<< (std::ostream &os, dynamic_bitset const &arg) |
Formatted output for the seqan3::dynamic_bitset . | |
std::istream & | operator>> (std::istream &is, dynamic_bitset &arg) |
Formatted input for the seqan3::dynamic_bitset . | |
A constexpr bitset implementation with dynamic size at compile time.
bit_capacity | The capacity of the dynamic bitset |
This implementation of a bitset can be constructed, accessed and modified at compile time. It has a fixed capacity but a dynamic size and provides all functionality of a sequence container. Note that it also models a reservable sequence container but all associated member functions are no-op because the capacity is fixed.
This container provides no thread-safety beyond the promise given also by the STL that all calls to const
member functions are safe from multiple threads (as long as no thread calls a non-const
member function at the same time).
using seqan3::dynamic_bitset< bit_capacity >::const_iterator = detail::random_access_iterator<dynamic_bitset const> |
The const_iterator
type of this container (a random access iterator).
using seqan3::dynamic_bitset< bit_capacity >::const_reference = bool |
Equals the value_type.
using seqan3::dynamic_bitset< bit_capacity >::difference_type = ptrdiff_t |
using seqan3::dynamic_bitset< bit_capacity >::iterator = detail::random_access_iterator<dynamic_bitset> |
The iterator type of this container (a random access iterator).
using seqan3::dynamic_bitset< bit_capacity >::reference = reference_proxy_type |
A proxy type that enables assignment.
using seqan3::dynamic_bitset< bit_capacity >::size_type = detail::min_viable_uint_t<bit_capacity> |
An unsigned integer type (usually std::size_t
).
using seqan3::dynamic_bitset< bit_capacity >::value_type = bool |
Equals bool
.
|
inlineconstexpr |
Construct from an uint64_t
.
[in] | value | The uint64_t to construct/assign from. |
std::invalid_argument | if value has bits set outside of [0, 58). |
Constant.
Throws std::invalid_argument value has a set bit past the 58 one, i.e. only bits in [0,58) may be set.
|
inlineconstexprnoexcept |
Construct from two iterators.
begin_it_type | Must model std::forward_iterator and value_type must be constructible from the reference type of begin_it_type . |
end_it_type | Must model std::sentinel_for. |
[in] | begin_it | Begin of range to construct/assign from. |
[in] | end_it | End of range to construct/assign from. |
Linear in the distance between begin_it
and end_it
.
No-throw guarantee.
|
inlineexplicitconstexprnoexcept |
Construct from a different range.
other_range_t | The type of range to be inserted; must satisfy std::ranges::input_range and value_type must be constructible from std::ranges::range_reference_t<other_range_t> . |
[in] | range | The sequence to construct/assign from. |
Linear in the size of range
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Construct with n
times value
.
[in] | n | Number of elements. |
[in] | value | The initial value to be assigned. |
Linear in n
.
No-throw guarantee.
|
inlineconstexpr |
Construction from literal.
[in] | lit | The literal to construct the string for. May only contain '0' and '1' . |
std::invalid_argument | if any character is not '0' or '1' . |
The char
literal is expected to be null-terminated (asserted in debug-mode). If it is not, the last character will be lost when copying to the instance of dynamic_bitset
.
Linear in the size of lit
.
Throws std::invalid_argument if any character is not '0'
or '1'
.
|
inlineconstexprnoexcept |
Checks if all bit are set.
true
if all bits are set or the bitset is empty, false
otherwise.
|
inlineconstexprnoexcept |
Checks if any bit is set.
true
if any bit is set, false
otherwise.
|
inlineconstexprnoexcept |
Assign from pair of iterators.
begin_it_type | Must model std::forward_iterator and the value_type must be constructible from the reference type of begin_it_type . |
end_it_type | Must model std::sentinel_for. |
[in] | begin_it | Begin of range to construct/assign from. |
[in] | end_it | End of range to construct/assign from. |
Linear in the distance between begin_it
and end_it
.
No-throw guarantee.
|
inlineconstexpr |
Assign from literal.
[in] | lit | The literal to assign the string from. May only contain '0' and '1' . |
std::invalid_argument | if any character is not '0' or '1' . |
The char
literal is expected to be null-terminated (asserted in debug-mode). If it is not, the last character will be lost when copying to the instance of dynamic_bitset
.
Linear in the size of lit
.
Throws std::invalid_argument if any character is not '0'
or '1'
.
|
inlineconstexprnoexcept |
Assign from a different range.
other_range_t | The type of range to be inserted; must satisfy std::ranges::input_range and value_type must be constructible from std::ranges::range_reference_t<other_range_t> . |
[in] | range | The sequences to construct/assign from. |
Linear in the size of range
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Assign with count
times value
.
[in] | count | Number of elements. |
[in] | value | The initial value to be assigned. |
Linear in count
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Assign from std::initializer_list
.
[in] | ilist | A std::initializer_list of value_type . |
Linear in the size of ilist
.
No-throw guarantee.
|
inlineconstexpr |
Returns the i-th element.
[in] | i | Index of the element to retrieve. |
std::out_of_range | If you access an element behind the last. |
i
.Constant.
Throws std::out_of_range if i >= size()
.
|
inlineconstexpr |
Returns the i-th element.
[in] | i | Index of the element to retrieve. |
std::out_of_range | If you access an element behind the last. |
i
.Constant.
Throws std::out_of_range if i >= size()
.
|
inlineconstexprnoexcept |
Returns the last element.
Calling back()
on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the last element.
Calling back()
on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the begin to the dynamic_bitset
.
|
inlineconstexprnoexcept |
Returns the begin to the dynamic_bitset
.
|
inlineconstexprnoexcept |
Returns the number of elements that the container is able to hold and resolves to bit_capacity
.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the begin to the dynamic_bitset
.
|
inlineconstexprnoexcept |
Returns iterator past the end of the dynamic_bitset
.
|
inlineconstexprnoexcept |
Removes all elements from the container.
reset()
, this method also sets the size to 0.Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the number of set bits.
|
inlineconstexprnoexcept |
Checks whether the container is empty.
true
if the container is empty, false
otherwise.Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns iterator past the end of the dynamic_bitset
.
|
inlineconstexprnoexcept |
Returns iterator past the end of the dynamic_bitset
.
|
inlineconstexprnoexcept |
Removes specified elements from the container.
[in] | begin_it | Begin of range to erase. |
[in] | end_it | Behind the end of range to erase. |
pos
refers to the last element, the end()
iterator is returned.Invalidates iterators and references at or after the point of the erase, including the end()
iterator.
The iterator begin_it does not need to be dereferenceable if begin_it==end_it
: erasing an empty range is a no-op.
Linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Removes specified elements from the container.
[in] | pos | Remove the element at pos. |
pos
refers to the last element, the end()
iterator is returned.Invalidates iterators and references at or after the point of the erase, including the end()
iterator.
The iterator pos
must be valid and dereferenceable. Thus the end()
iterator (which is valid, but is not dereferencable) cannot be used as a value for pos
.
Linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Flips all bits (binary NOT).
No-throw guarantee.
Constant.
|
inlineconstexpr |
Flips the i'th bit (binary NOT).
[in] | i | Index of the bit to flip. |
std::out_of_range | if you access an element behind the last. |
Throws std::out_of_range if i >= size()
.
Constant.
|
inlineconstexprnoexcept |
Returns the first element.
Calling front()
on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the first element.
Calling front()
on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Inserts elements from range [begin_it, end_it)
before pos
in the container.
begin_it_type | Must model std::forward_iterator and the value_type must be constructible from the reference type of begin_it_type. |
end_it_type | Must model std::sentinel_for. |
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
[in] | begin_it | Begin of range to construct/assign from. |
[in] | end_it | End of range to construct/assign from. |
pos
if begin_it==end_it
.The behaviour is undefined if begin_it
and end_it
are iterators into *this
or if, given the size n
of the range represented by [begin_t
, end_it
), size()
+ n
> capacity()
.
Worst-case linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Inserts count
copies of value
before position in the container.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
[in] | count | Number of copies. |
[in] | value | Element value to insert. |
pos
if count==0
.If size()
+ count
> capacity()
this function results in undefined behaviour.
Worst-case linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Inserts elements from initializer list before pos
in the container.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
[in] | ilist | Initializer list with values to insert. |
pos
if ilist
is empty.Given the size n
of ilist
, this function results in undefined behaviour if size()
+ n
> capacity()
.
Worst-case linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Inserts value
before pos
in the container.
[in] | pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
[in] | value | Element value to insert. |
Inserting a value although the maximum capacity is reached is undefined behaviour.
Worst-case linear in size()
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the maximum number of elements the container is able to hold and resolves to bit_capacity
.
This value typically reflects the theoretical limit on the size of the container. At runtime, the size of the container may be limited to a value smaller than max_size()
by the amount of RAM available.
For the dynamic_bitset
holds: max_size() = capacity()
.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Checks if no bit is set.
true
if no bit is set, false
otherwise.
|
inlineconstexprnoexcept |
Sets the bits to the result of binary AND on corresponding pairs of bits of *this
and rhs
.
[in] | rhs | dynamic_bitset to perform binary AND with. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Performs binary shift left.
[in] | count | Amount to shift to the left. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Performs binary shift left on the current object.
[in] | count | Amount to shift to the left. |
No-throw guarantee.
Constant.
|
inlineconstexpr |
Assign from literal.
[in] | lit | The literal to assign the string from. May only contain '0' and '1' . |
std::invalid_argument | if any character is not '0' or '1' . |
The char
literal is expected to be null-terminated (asserted in debug-mode). If it is not, the last character will be lost when copying to the instance of dynamic_bitset
.
Linear in the size of lit
.
Throws std::invalid_argument if any character is not '0'
or '1'
.
|
inlineconstexprnoexcept |
Assign from std::initializer_list
.
[in] | ilist | A std::initializer_list of value_type . |
Linear in the size of ilist
.
No-throw guarantee.
|
inlineconstexprnoexcept |
Performs binary shift right.
[in] | count | Amount to shift to the right. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Performs binary shift right on the current object.
[in] | count | Amount to shift to the right. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Returns the i-th element.
[in] | i | The element to retrieve. |
i
.Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Returns the i-th element.
[in] | i | The element to retrieve. |
i
.Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Sets the bits to the result of binary XOR on corresponding pairs of bits of *this
and rhs
.
[in] | rhs | dynamic_bitset to perform binary XOR with. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Sets the bits to the result of binary OR on corresponding pairs of bits of *this
and rhs
.
[in] | rhs | dynamic_bitset to perform binary OR with. |
No-throw guarantee.
Constant.
|
inlineconstexprnoexcept |
Returns a temporary copy of *this
with all bits flipped (binary NOT).
No-throw guarantee.
Thread safe.
Constant.
|
inlineconstexprnoexcept |
Removes the last element of the container.
Calling pop_back()
on an empty container is undefined. In debug mode an assertion will be thrown.
No iterators or references except for back()
and end()
are invalidated.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Appends the given element value
to the end of the container.
[in] | value | The value to append. |
If the new size(
) is greater than capacity()
this is undefined behaviour.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Direct access to the underlying bit field.
|
inlineconstexprnoexcept |
Direct access to the underlying bit field.
|
inlineconstexprnoexcept |
Since the capacity is fixed on compile time, this is a no-op.
|
inlineconstexprnoexcept |
Sets all bits to 0
.
clear()
, this method does not modify the size.No-throw guarantee.
Constant.
|
inlineconstexpr |
Sets the i'th bit to false.
[in] | i | Index of the bit to reset. |
std::out_of_range | if you access an element behind the last. |
Throws std::out_of_range if i >= size()
.
Constant.
|
inlineconstexprnoexcept |
Resizes the container to contain count elements.
[in] | count | The new size. |
[in] | value | Append copies of value when resizing, default = false . |
If count
is greater than capacity()
this is undefined behaviour. If the dynamic_bitset
is enlarged, bits in [0, size()
) stay the same and bits in [size()
, count
) are set to value
. If the dynamic_bitset
is shrunk, bits in [0, count
) stay the same and bits in [count
, size()
) are set to 0
.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Sets all bits to 1
.
No-throw guarantee.
Constant.
|
inlineconstexpr |
Sets the i'th bit to value
.
[in] | i | Index of the bit to set. |
[in] | value | Value to set. Default true. |
std::out_of_range | if you access an element behind the last. |
Throws std::out_of_range if i >= size()
.
Constant.
|
inlineconstexprnoexcept |
Since the capacity is fixed on compile time, this is a no-op.
|
inlineconstexprnoexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end())
.
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Swap contents with another instance.
[in] | rhs | The other instance to swap with. |
Linear in the size of both containers.
No-throw guarantee if value_type is std::is_nothrow_copy_constructible.
|
inlineconstexpr |
Returns the i-th element.
[in] | i | Index of the element to retrieve. |
std::out_of_range | If you access an element behind the last. |
i
.Constant.
Throws std::out_of_range if i >= size()
.
|
inline |
Converts the dynamic_bitset
to a std::string
.
char_t | Char type; must model seqan3::builtin_character. |
[in] | zero | builtin_character of type char_t representing false . Default '0' . |
[in] | one | builtin_character of type char_t representing true . Default '1' . |
std::bad_alloc | from the the std::string constructor. |
std::string
representing the dynamic_bitset
.std::string
is not constexpr.Linear in size()
.
Throws std::bad_alloc from the std::string
constructor.
|
inlineconstexpr |
Converts the dynamic_bitset
to an unsigned long long
integer.
std::overflow_error | if the value cannot be represented in unsigned long long . |
unsigned long long
representing the dynamic_bitset
.Constant.
Throws std::overflow_error if the value cannot be represented in unsigned long long
.
|
inlineconstexpr |
Converts the dynamic_bitset
to an unsigned long
integer.
std::overflow_error | if the value cannot be represented in unsigned long . |
unsigned long
representing the dynamic_bitset
.Constant.
Throws std::overflow_error if the value cannot be represented in unsigned long
.
|
friend |
Performs element-wise comparison.
|
friend |
Returns dynamic_bitset containing the result of binary AND on corresponding pairs of bits of lhs
and rhs
.
|
friend |
Performs element-wise comparison.
|
friend |
Formatted output for the seqan3::dynamic_bitset
.
[in,out] | os | The std::basic_ostream to write to. |
[in] | arg | The seqan3::dynamic_bitset to read from. |
os
.Internally calls os << arg.to_string()
.
|
friend |
Performs element-wise comparison.
|
friend |
Performs element-wise comparison.
|
friend |
Performs element-wise comparison.
|
friend |
Performs element-wise comparison.
|
friend |
Formatted input for the seqan3::dynamic_bitset
.
[in,out] | is | The std::basic_istream to read from. |
[out] | arg | The seqan3::dynamic_bitset to write to. |
is
.Reads at most seqan3::dynamic_bitset::max_size()
characters from the stream. If a stream error occurred or no characters could be extracted the std::ios_base::failbit
is set. This may throw an exception.
|
friend |
Returns dynamic_bitset containing the result of binary XOR on corresponding pairs of bits of lhs
and rhs
.
|
friend |
Returns dynamic_bitset containing the result of binary OR on corresponding pairs of bits of lhs
and rhs
.
|
friend |
Swap contents with another instance.
[in] | lhs | The first instance. |
[in] | rhs | The other instance to swap with. |
Linear in the size of both containers.
No-throw guarantee if value_type is std::is_nothrow_copy_constructible.