SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::dynamic_bitset< bit_capacity > Class Template Reference

A constexpr bitset implementation with dynamic size at compile time. More...

#include <seqan3/range/container/dynamic_bitset.hpp>

+ Inheritance diagram for seqan3::dynamic_bitset< bit_capacity >:

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_bitsetoperator= (dynamic_bitset const &) noexcept=default
 Defaulted.
 
constexpr dynamic_bitsetoperator= (dynamic_bitset &&) noexcept=default
 Defaulted.
 
 ~dynamic_bitset () noexcept=default
 Defaulted.
 
constexpr dynamic_bitset (uint64_t const value)
 Construct from an uint64_t. More...
 
template<std::forward_iterator begin_it_type, typename end_it_type >
constexpr dynamic_bitset (begin_it_type begin_it, end_it_type end_it) noexcept
 Construct from two iterators. More...
 
template<std::ranges::input_range other_range_t>
constexpr dynamic_bitset (other_range_t &&range) noexcept
 Construct from a different range. More...
 
constexpr dynamic_bitset (size_type const n, value_type const value) noexcept
 Construct with n times value. More...
 
constexpr dynamic_bitsetoperator= (std::initializer_list< value_type > const ilist) noexcept
 Assign from std::initializer_list. More...
 
template<size_t N>
constexpr dynamic_bitset (char const (&lit)[N])
 Construction from literal. More...
 
template<size_t N>
constexpr dynamic_bitsetoperator= (char const (&lit)[N])
 Assign from literal. More...
 
template<size_t N>
constexpr void assign (char const (&lit)[N])
 Assign from literal. More...
 
constexpr void assign (std::initializer_list< value_type > const ilist) noexcept
 Assign from std::initializer_list. More...
 
constexpr void assign (size_type const count, value_type const value) noexcept
 Assign with count times value. More...
 
template<std::ranges::input_range other_range_t>
constexpr void assign (other_range_t &&range) noexcept
 Assign from a different range. More...
 
template<std::forward_iterator begin_it_type, typename end_it_type >
constexpr void assign (begin_it_type begin_it, end_it_type end_it) noexcept
 Assign from pair of iterators. More...
 
Iterators
constexpr iterator begin () noexcept
 Returns the begin to the dynamic_bitset. More...
 
constexpr const_iterator begin () const noexcept
 Returns the begin to the dynamic_bitset. More...
 
constexpr const_iterator cbegin () const noexcept
 Returns the begin to the dynamic_bitset. More...
 
constexpr iterator end () noexcept
 Returns iterator past the end of the dynamic_bitset. More...
 
constexpr const_iterator end () const noexcept
 Returns iterator past the end of the dynamic_bitset. More...
 
constexpr const_iterator cend () const noexcept
 Returns iterator past the end of the dynamic_bitset. More...
 
Bit manipulation
constexpr dynamic_bitsetoperator &= (dynamic_bitset const &rhs) noexcept
 Sets the bits to the result of binary AND on corresponding pairs of bits of *this and rhs. More...
 
constexpr dynamic_bitsetoperator|= (dynamic_bitset const &rhs) noexcept
 Sets the bits to the result of binary OR on corresponding pairs of bits of *this and rhs. More...
 
constexpr dynamic_bitsetoperator^= (dynamic_bitset const &rhs) noexcept
 Sets the bits to the result of binary XOR on corresponding pairs of bits of *this and rhs. More...
 
constexpr dynamic_bitset operator~ () const noexcept
 Returns a temporary copy of *this with all bits flipped (binary NOT). More...
 
constexpr dynamic_bitsetoperator<<= (size_t const count) noexcept
 Performs binary shift left on the current object. More...
 
constexpr dynamic_bitsetoperator>>= (size_t const count) noexcept
 Performs binary shift right on the current object. More...
 
constexpr dynamic_bitset operator>> (size_t const count) const noexcept
 Performs binary shift right. More...
 
constexpr dynamic_bitset operator<< (size_t const count) const noexcept
 Performs binary shift left. More...
 
constexpr dynamic_bitsetset () noexcept
 Sets all bits to 1. More...
 
constexpr dynamic_bitsetset (size_t const i, bool const value=true)
 Sets the i'th bit to value. More...
 
constexpr dynamic_bitsetreset () noexcept
 Sets all bits to 0. More...
 
constexpr dynamic_bitsetreset (size_t const i)
 Sets the i'th bit to false. More...
 
constexpr dynamic_bitsetflip () noexcept
 Flips all bits (binary NOT). More...
 
constexpr dynamic_bitsetflip (size_t const i)
 Flips the i'th bit (binary NOT). More...
 
Element Access
constexpr bool all () const noexcept
 Checks if all bit are set. More...
 
constexpr bool any () const noexcept
 Checks if any bit is set. More...
 
constexpr bool none () const noexcept
 Checks if no bit is set. More...
 
constexpr size_type count () const noexcept
 Returns the number of set bits.
 
constexpr reference at (size_t const i)
 Returns the i-th element. More...
 
constexpr const_reference at (size_t const i) const
 Returns the i-th element. More...
 
constexpr const_reference test (size_t const i) const
 Returns the i-th element. More...
 
constexpr reference operator[] (size_t const i) noexcept
 Returns the i-th element. More...
 
constexpr const_reference operator[] (size_t const i) const noexcept
 Returns the i-th element. More...
 
constexpr reference front () noexcept
 Returns the first element. More...
 
constexpr const_reference front () const noexcept
 Returns the first element. More...
 
constexpr reference back () noexcept
 Returns the last element. More...
 
constexpr const_reference back () const noexcept
 Returns the last element. More...
 
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. More...
 
Capacity
constexpr bool empty () const noexcept
 Checks whether the container is empty. More...
 
constexpr size_type size () const noexcept
 Returns the number of elements in the container, i.e. std::distance(begin(), end()). More...
 
constexpr size_type max_size () const noexcept
 Returns the maximum number of elements the container is able to hold and resolves to bit_capacity. More...
 
constexpr size_type capacity () const noexcept
 Returns the number of elements that the container is able to hold and resolves to bit_capacity. More...
 
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. More...
 
constexpr iterator insert (const_iterator pos, value_type const value) noexcept
 Inserts value before pos in the container. More...
 
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. More...
 
template<std::forward_iterator begin_it_type, typename end_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. More...
 
constexpr iterator insert (const_iterator pos, std::initializer_list< value_type > const &ilist) noexcept
 Inserts elements from initializer list before pos in the container. More...
 
constexpr iterator erase (const_iterator begin_it, const_iterator end_it) noexcept
 Removes specified elements from the container. More...
 
constexpr iterator erase (const_iterator pos) noexcept
 Removes specified elements from the container. More...
 
constexpr void push_back (value_type const value) noexcept
 Appends the given element value to the end of the container. More...
 
constexpr void pop_back () noexcept
 Removes the last element of the container. More...
 
constexpr void resize (size_type const count, value_type const value=false) noexcept
 Resizes the container to contain count elements. More...
 
constexpr void swap (dynamic_bitset &rhs) noexcept
 Swap contents with another instance. More...
 
constexpr void swap (dynamic_bitset &&rhs) noexcept
 
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. More...
 
constexpr unsigned long to_ulong () const
 Converts the dynamic_bitset to an unsigned long integer. More...
 
constexpr unsigned long long to_ullong () const
 Converts the dynamic_bitset to an unsigned long long integer. More...
 

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. More...
 
Binary operators
template<size_t cap>
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. More...
 
template<size_t cap>
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. More...
 
template<size_t cap>
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. More...
 
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::ostreamoperator<< (std::ostream &os, dynamic_bitset const &arg)
 Formatted output for the seqan3::dynamic_bitset. More...
 
std::istreamoperator>> (std::istream &is, dynamic_bitset &arg)
 Formatted input for the seqan3::dynamic_bitset. More...
 
template<typename char_t >
debug_stream_type< char_t > & operator<< (debug_stream_type< char_t > &s, dynamic_bitset arg)
 Formatted debug output for the seqan3::dynamic_bitset. More...
 

Detailed Description

template<size_t bit_capacity = 58>
class seqan3::dynamic_bitset< bit_capacity >

A constexpr bitset implementation with dynamic size at compile time.

Template Parameters
bit_capacityThe 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.

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"}; // Construct from string.
seqan3::dynamic_bitset const t2{0b1011'1000}; // Construct from binary literal or integer.
seqan3::debug_stream << t1 << '\n'; // Debug printing inserts separators: 1000'1100
std::cout << t2 << '\n'; // Standard printing does not: 10111000
t1 &= t2; // Assign t1 the result of a binary AND of t1 and t2.
seqan3::debug_stream << t1 << '\n'; // 1000'1000
}

Thread safety

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).

Constructor & Destructor Documentation

◆ dynamic_bitset() [1/5]

template<size_t bit_capacity = 58>
constexpr seqan3::dynamic_bitset< bit_capacity >::dynamic_bitset ( uint64_t const  value)
inline

Construct from an uint64_t.

Parameters
[in]valueThe uint64_t to construct/assign from.
Exceptions
std::invalid_argumentif value has bits set outside of [0, 58).

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111}; // Use binary literal.
seqan3::dynamic_bitset t2{0b0000'1000'1111}; // Leading zeros are stripped.
seqan3::dynamic_bitset t3{832}; // Use a number.
seqan3::debug_stream << t1 << '\n'; // 1011'1000'1111
seqan3::debug_stream << t2 << '\n'; // 1000'1111
seqan3::debug_stream << t3 << '\n'; // 1101'0000'00
}

Complexity

Constant.

Exceptions

Throws std::invalid_argument value has a set bit past the 58 one, i.e. only bits in [0,58) may be set.

◆ dynamic_bitset() [2/5]

template<size_t bit_capacity = 58>
template<std::forward_iterator begin_it_type, typename end_it_type >
constexpr seqan3::dynamic_bitset< bit_capacity >::dynamic_bitset ( begin_it_type  begin_it,
end_it_type  end_it 
)
inlinenoexcept

Construct from two iterators.

Template Parameters
begin_it_typeMust model std::forward_iterator and value_type must be constructible from the reference type of begin_it_type.
end_it_typeMust model std::sentinel_for.
Parameters
[in]begin_itBegin of range to construct/assign from.
[in]end_itEnd of range to construct/assign from.

Complexity

Linear in the distance between begin_it and end_it.

Exceptions

No-throw guarantee.

◆ dynamic_bitset() [3/5]

template<size_t bit_capacity = 58>
template<std::ranges::input_range other_range_t>
constexpr seqan3::dynamic_bitset< bit_capacity >::dynamic_bitset ( other_range_t &&  range)
inlineexplicitnoexcept

Construct from a different range.

Template Parameters
other_range_tThe type of range to be inserted; must satisfy std::ranges::input_range and value_type must be constructible from reference_t<other_range_t>.
Parameters
[in]rangeThe sequence to construct/assign from.

Complexity

Linear in the size of range.

Exceptions

No-throw guarantee.

◆ dynamic_bitset() [4/5]

template<size_t bit_capacity = 58>
constexpr seqan3::dynamic_bitset< bit_capacity >::dynamic_bitset ( size_type const  n,
value_type const  value 
)
inlinenoexcept

Construct with n times value.

Parameters
[in]nNumber of elements.
[in]valueThe initial value to be assigned.

Complexity

Linear in n.

Exceptions

No-throw guarantee.

◆ dynamic_bitset() [5/5]

template<size_t bit_capacity = 58>
template<size_t N>
constexpr seqan3::dynamic_bitset< bit_capacity >::dynamic_bitset ( char const (&)  lit[N])
inline

Construction from literal.

Parameters
[in]litThe literal to construct the string for. May only contain '0' and '1'.
Exceptions
std::invalid_argumentif 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.

Example

int main()
{
seqan3::dynamic_bitset t1{"101110001111"}; // Use character literal.
seqan3::dynamic_bitset t2{"000010001111"}; // Leading zeros are kept.
seqan3::debug_stream << t1 << '\n'; // 1011'1000'1111
seqan3::debug_stream << t2 << '\n'; // 0000'1000'1111
}

Complexity

Linear in the size of lit.

Exceptions

Throws std::invalid_argument if any character is not '0' or '1'.

Member Function Documentation

◆ all()

template<size_t bit_capacity = 58>
constexpr bool seqan3::dynamic_bitset< bit_capacity >::all ( ) const
inlinenoexcept

Checks if all bit are set.

Returns
true if all bits are set or the bitset is empty, false otherwise.

◆ any()

template<size_t bit_capacity = 58>
constexpr bool seqan3::dynamic_bitset< bit_capacity >::any ( ) const
inlinenoexcept

Checks if any bit is set.

Returns
true if any bit is set, false otherwise.

◆ assign() [1/5]

template<size_t bit_capacity = 58>
template<size_t N>
constexpr void seqan3::dynamic_bitset< bit_capacity >::assign ( char const (&)  lit[N])
inline

Assign from literal.

Parameters
[in]litThe literal to assign the string from. May only contain '0' and '1'.
Exceptions
std::invalid_argumentif 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.

Complexity

Linear in the size of lit.

Exceptions

Throws std::invalid_argument if any character is not '0' or '1'.

◆ assign() [2/5]

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::assign ( std::initializer_list< value_type > const  ilist)
inlinenoexcept

Assign from std::initializer_list.

Parameters
[in]ilistA std::initializer_list of value_type.

Complexity

Linear in the size of ilist.

Exceptions

No-throw guarantee.

◆ assign() [3/5]

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::assign ( size_type const  count,
value_type const  value 
)
inlinenoexcept

Assign with count times value.

Parameters
[in]countNumber of elements.
[in]valueThe initial value to be assigned.

Complexity

Linear in count.

Exceptions

No-throw guarantee.

◆ assign() [4/5]

template<size_t bit_capacity = 58>
template<std::ranges::input_range other_range_t>
constexpr void seqan3::dynamic_bitset< bit_capacity >::assign ( other_range_t &&  range)
inlinenoexcept

Assign from a different range.

Template Parameters
other_range_tThe type of range to be inserted; must satisfy std::ranges::input_range and value_type must be constructible from reference_t<other_range_t>.
Parameters
[in]rangeThe sequences to construct/assign from.

Complexity

Linear in the size of range.

Exceptions

No-throw guarantee.

◆ assign() [5/5]

template<size_t bit_capacity = 58>
template<std::forward_iterator begin_it_type, typename end_it_type >
constexpr void seqan3::dynamic_bitset< bit_capacity >::assign ( begin_it_type  begin_it,
end_it_type  end_it 
)
inlinenoexcept

Assign from pair of iterators.

Template Parameters
begin_it_typeMust model std::forward_iterator and the value_type must be constructible from the reference type of begin_it_type.
end_it_typeMust model std::sentinel_for.
Parameters
[in]begin_itBegin of range to construct/assign from.
[in]end_itEnd of range to construct/assign from.

Complexity

Linear in the distance between begin_it and end_it.

Exceptions

No-throw guarantee.

◆ at() [1/2]

template<size_t bit_capacity = 58>
constexpr reference seqan3::dynamic_bitset< bit_capacity >::at ( size_t const  i)
inline

Returns the i-th element.

Parameters
[in]iIndex of the element to retrieve.
Exceptions
std::out_of_rangeIf you access an element behind the last.
Returns
A reference to the value at position i.

Complexity

Constant.

Exceptions

Throws std::out_of_range if i >= size().

◆ at() [2/2]

template<size_t bit_capacity = 58>
constexpr const_reference seqan3::dynamic_bitset< bit_capacity >::at ( size_t const  i) const
inline

Returns the i-th element.

Parameters
[in]iIndex of the element to retrieve.
Exceptions
std::out_of_rangeIf you access an element behind the last.
Returns
A reference to the value at position i.

Complexity

Constant.

Exceptions

Throws std::out_of_range if i >= size().

◆ back() [1/2]

template<size_t bit_capacity = 58>
constexpr reference seqan3::dynamic_bitset< bit_capacity >::back ( )
inlinenoexcept

Returns the last element.

Returns
A reference to the value at the last position.

Calling back() on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ back() [2/2]

template<size_t bit_capacity = 58>
constexpr const_reference seqan3::dynamic_bitset< bit_capacity >::back ( ) const
inlinenoexcept

Returns the last element.

Returns
A reference to the value at the last position.

Calling back() on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ begin() [1/2]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::begin ( )
inlinenoexcept

Returns the begin to the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ begin() [2/2]

template<size_t bit_capacity = 58>
constexpr const_iterator seqan3::dynamic_bitset< bit_capacity >::begin ( ) const
inlinenoexcept

Returns the begin to the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ capacity()

template<size_t bit_capacity = 58>
constexpr size_type seqan3::dynamic_bitset< bit_capacity >::capacity ( ) const
inlinenoexcept

Returns the number of elements that the container is able to hold and resolves to bit_capacity.

Returns
The capacity of the currently allocated storage.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ cbegin()

template<size_t bit_capacity = 58>
constexpr const_iterator seqan3::dynamic_bitset< bit_capacity >::cbegin ( ) const
inlinenoexcept

Returns the begin to the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ cend()

template<size_t bit_capacity = 58>
constexpr const_iterator seqan3::dynamic_bitset< bit_capacity >::cend ( ) const
inlinenoexcept

Returns iterator past the end of the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ clear()

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::clear ( )
inlinenoexcept

Removes all elements from the container.

Attention
In contrast to reset(), this method also sets the size to 0.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ empty()

template<size_t bit_capacity = 58>
constexpr bool seqan3::dynamic_bitset< bit_capacity >::empty ( ) const
inlinenoexcept

Checks whether the container is empty.

Returns
true if the container is empty, false otherwise.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ end() [1/2]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::end ( )
inlinenoexcept

Returns iterator past the end of the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ end() [2/2]

template<size_t bit_capacity = 58>
constexpr const_iterator seqan3::dynamic_bitset< bit_capacity >::end ( ) const
inlinenoexcept

Returns iterator past the end of the dynamic_bitset.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// begin() refers to the rightmost position.
for (auto it = t1.begin(); it != t1.end(); ++it)
seqan3::debug_stream << *it; // 1111'0001'1101
}

◆ erase() [1/2]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::erase ( const_iterator  begin_it,
const_iterator  end_it 
)
inlinenoexcept

Removes specified elements from the container.

Parameters
[in]begin_itBegin of range to erase.
[in]end_itBehind the end of range to erase.
Returns
Iterator following the last element removed. If the iterator 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.

Complexity

Linear in size().

Exceptions

No-throw guarantee.

◆ erase() [2/2]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::erase ( const_iterator  pos)
inlinenoexcept

Removes specified elements from the container.

Parameters
[in]posRemove the element at pos.
Returns
Iterator following the last element removed. If the iterator 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.

Complexity

Linear in size().

Exceptions

No-throw guarantee.

◆ flip() [1/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::flip ( )
inlinenoexcept

Flips all bits (binary NOT).

Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.flip();
seqan3::debug_stream << t1 << '\n'; // 0111'0011
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ flip() [2/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::flip ( size_t const  i)
inline

Flips the i'th bit (binary NOT).

Parameters
[in]iIndex of the bit to flip.
Exceptions
std::out_of_rangeif you access an element behind the last.
Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.flip(0);
t1.flip(3);
seqan3::debug_stream << t1 << '\n'; // 1000'0101
}

Exception

Throws std::out_of_range if i >= size().

Complexity

Constant.

◆ front() [1/2]

template<size_t bit_capacity = 58>
constexpr reference seqan3::dynamic_bitset< bit_capacity >::front ( )
inlinenoexcept

Returns the first element.

Returns
A reference to the value at the first position.

Calling front() on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ front() [2/2]

template<size_t bit_capacity = 58>
constexpr const_reference seqan3::dynamic_bitset< bit_capacity >::front ( ) const
inlinenoexcept

Returns the first element.

Returns
A reference to the value at the first position.

Calling front() on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ insert() [1/4]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::insert ( const_iterator  pos,
value_type const  value 
)
inlinenoexcept

Inserts value before pos in the container.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]valueElement value to insert.
Returns
Iterator pointing to the inserted value.

Inserting a value although the maximum capacity is reached is undefined behaviour.

Complexity

Worst-case linear in size().

Exceptions

No-throw guarantee.

◆ insert() [2/4]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::insert ( const_iterator  pos,
size_type const  count,
value_type const  value 
)
inlinenoexcept

Inserts count copies of value before position in the container.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]countNumber of copies.
[in]valueElement value to insert.
Returns
Iterator pointing to the first element inserted, or pos if count==0.

If size() + count > capacity() this function results in undefined behaviour.

Complexity

Worst-case linear in size().

Exceptions

No-throw guarantee.

◆ insert() [3/4]

template<size_t bit_capacity = 58>
template<std::forward_iterator begin_it_type, typename end_it_type >
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::insert ( const_iterator  pos,
begin_it_type  begin_it,
end_it_type  end_it 
)
inlinenoexcept

Inserts elements from range [begin_it, end_it) before pos in the container.

Template Parameters
begin_it_typeMust model std::forward_iterator and the value_type must be constructible from the reference type of begin_it_type.
end_it_typeMust model std::sentinel_for.
Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]begin_itBegin of range to construct/assign from.
[in]end_itEnd of range to construct/assign from.
Returns
Iterator pointing to the first element inserted, or 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().

Complexity

Worst-case linear in size().

Exceptions

No-throw guarantee.

◆ insert() [4/4]

template<size_t bit_capacity = 58>
constexpr iterator seqan3::dynamic_bitset< bit_capacity >::insert ( const_iterator  pos,
std::initializer_list< value_type > const &  ilist 
)
inlinenoexcept

Inserts elements from initializer list before pos in the container.

Parameters
[in]posIterator before which the content will be inserted. pos may be the end() iterator.
[in]ilistInitializer list with values to insert.
Returns
Iterator pointing to the first element inserted, or pos if ilist is empty.

Given the size n of ilist, this function results in undefined behaviour if size() + n > capacity().

Complexity

Worst-case linear in size().

Exceptions

No-throw guarantee.

◆ max_size()

template<size_t bit_capacity = 58>
constexpr size_type seqan3::dynamic_bitset< bit_capacity >::max_size ( ) const
inlinenoexcept

Returns the maximum number of elements the container is able to hold and resolves to bit_capacity.

Returns
The number of elements in the container.

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().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ none()

template<size_t bit_capacity = 58>
constexpr bool seqan3::dynamic_bitset< bit_capacity >::none ( ) const
inlinenoexcept

Checks if no bit is set.

Returns
true if no bit is set, false otherwise.

◆ operator &=()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator&= ( dynamic_bitset< bit_capacity > const &  rhs)
inlinenoexcept

Sets the bits to the result of binary AND on corresponding pairs of bits of *this and rhs.

Parameters
[in]rhsdynamic_bitset to perform binary AND with.
Returns
*this
Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
seqan3::dynamic_bitset const t2{0b1011'1000};
t1 &= t2;
seqan3::debug_stream << t1 << '\n'; // 1000'1000
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator<<()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset seqan3::dynamic_bitset< bit_capacity >::operator<< ( size_t const  count) const
inlinenoexcept

Performs binary shift left.

Parameters
[in]countAmount to shift to the left.
Returns
Copy of *this with bits shifted count to the left.

Example

int main()
{
seqan3::dynamic_bitset const t1{"10001100"};
seqan3::dynamic_bitset t2 = t1 << 3;
seqan3::debug_stream << t2 << '\n'; // 0110'0000
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator<<=()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator<<= ( size_t const  count)
inlinenoexcept

Performs binary shift left on the current object.

Parameters
[in]countAmount to shift to the left.
Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1 <<= 3;
seqan3::debug_stream << t1 << '\n'; // 0110'0000
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator=() [1/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator= ( std::initializer_list< value_type > const  ilist)
inlinenoexcept

Assign from std::initializer_list.

Parameters
[in]ilistA std::initializer_list of value_type.

Complexity

Linear in the size of ilist.

Exceptions

No-throw guarantee.

◆ operator=() [2/2]

template<size_t bit_capacity = 58>
template<size_t N>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator= ( char const (&)  lit[N])
inline

Assign from literal.

Parameters
[in]litThe literal to assign the string from. May only contain '0' and '1'.
Exceptions
std::invalid_argumentif 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.

Complexity

Linear in the size of lit.

Exceptions

Throws std::invalid_argument if any character is not '0' or '1'.

◆ operator>>()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset seqan3::dynamic_bitset< bit_capacity >::operator>> ( size_t const  count) const
inlinenoexcept

Performs binary shift right.

Parameters
[in]countAmount to shift to the right.
Returns
Copy of *this with bits shifted count to the right.

Example

int main()
{
seqan3::dynamic_bitset const t1{"10001100"};
seqan3::dynamic_bitset t2 = t1 >> 3;
seqan3::debug_stream << t2 << '\n'; // 0001'0001
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator>>=()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator>>= ( size_t const  count)
inlinenoexcept

Performs binary shift right on the current object.

Parameters
[in]countAmount to shift to the right.
Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1 >>= 3;
seqan3::debug_stream << t1 << '\n'; // 0001'0001
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator[]() [1/2]

template<size_t bit_capacity = 58>
constexpr reference seqan3::dynamic_bitset< bit_capacity >::operator[] ( size_t const  i)
inlinenoexcept

Returns the i-th element.

Parameters
[in]iThe element to retrieve.
Returns
A reference to the value at position i.

Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// Positions are 0-based and start at the rightmost bit.
for (size_t i = 0; i < t1.size(); ++i)
seqan3::debug_stream << t1[i]; // 1111'0001'1101
}

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ operator[]() [2/2]

template<size_t bit_capacity = 58>
constexpr const_reference seqan3::dynamic_bitset< bit_capacity >::operator[] ( size_t const  i) const
inlinenoexcept

Returns the i-th element.

Parameters
[in]iThe element to retrieve.
Returns
A reference to the value at position i.

Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.

Example

int main()
{
seqan3::dynamic_bitset t1{0b1011'1000'1111};
// Positions are 0-based and start at the rightmost bit.
for (size_t i = 0; i < t1.size(); ++i)
seqan3::debug_stream << t1[i]; // 1111'0001'1101
}

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ operator^=()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator^= ( dynamic_bitset< bit_capacity > const &  rhs)
inlinenoexcept

Sets the bits to the result of binary XOR on corresponding pairs of bits of *this and rhs.

Parameters
[in]rhsdynamic_bitset to perform binary XOR with.
Returns
*this
Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
seqan3::dynamic_bitset const t2{0b1011'1000};
t1 ^= t2;
seqan3::debug_stream << t1 << '\n'; // 0011'0100
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator|=()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::operator|= ( dynamic_bitset< bit_capacity > const &  rhs)
inlinenoexcept

Sets the bits to the result of binary OR on corresponding pairs of bits of *this and rhs.

Parameters
[in]rhsdynamic_bitset to perform binary OR with.
Returns
*this
Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
seqan3::dynamic_bitset const t2{0b1011'1000};
t1 |= t2;
seqan3::debug_stream << t1 << '\n'; // 1011'1100
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ operator~()

template<size_t bit_capacity = 58>
constexpr dynamic_bitset seqan3::dynamic_bitset< bit_capacity >::operator~ ( ) const
inlinenoexcept

Returns a temporary copy of *this with all bits flipped (binary NOT).

Returns
Copy of *this with all bits flipped.

Example

int main()
{
seqan3::dynamic_bitset const t1{"10001100"};
seqan3::debug_stream << t2 << '\n'; // 0111'0011
}

Exception

No-throw guarantee.

Thread-safety

Thread safe.

Complexity

Constant.

◆ pop_back()

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::pop_back ( )
inlinenoexcept

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.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ push_back()

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::push_back ( value_type const  value)
inlinenoexcept

Appends the given element value to the end of the container.

Parameters
[in]valueThe value to append.

If the new size() is greater than capacity() this is undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ raw_data()

template<size_t bit_capacity = 58>
constexpr bitfield const* seqan3::dynamic_bitset< bit_capacity >::raw_data ( ) const
inlinenoexcept

Direct access to the underlying bit field.

◆ reset() [1/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::reset ( )
inlinenoexcept

Sets all bits to 0.

Returns
*this
Attention
In contrast to clear(), this method does not modify the size.

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.reset();
seqan3::debug_stream << t1 << '\n'; // 0000'0000
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ reset() [2/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::reset ( size_t const  i)
inline

Sets the i'th bit to false.

Parameters
[in]iIndex of the bit to reset.
Exceptions
std::out_of_rangeif you access an element behind the last.
Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.reset(2);
t1.reset(3);
seqan3::debug_stream << t1 << '\n'; // 1000'0000
}

Exception

Throws std::out_of_range if i >= size().

Complexity

Constant.

◆ resize()

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::resize ( size_type const  count,
value_type const  value = false 
)
inlinenoexcept

Resizes the container to contain count elements.

Parameters
[in]countThe new size.
[in]valueAppend 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.

Example

int main()
{
t1.resize(8); // Enlarge to 8.
seqan3::debug_stream << t1 << '\n'; // 0000'1100
t1.resize(5); // Shrink to 5, last three bits (5, 6, 7) are set to false.
seqan3::debug_stream << t1 << '\n'; // 0110'0
t1.resize(10, true); // Enlarge to 10 and set new bits to true.
seqan3::debug_stream << t1 << '\n'; // 1111'1011'00
}

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ set() [1/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::set ( )
inlinenoexcept

Sets all bits to 1.

Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.set();
seqan3::debug_stream << t1 << '\n'; // 1111'1111
}

Exception

No-throw guarantee.

Complexity

Constant.

◆ set() [2/2]

template<size_t bit_capacity = 58>
constexpr dynamic_bitset& seqan3::dynamic_bitset< bit_capacity >::set ( size_t const  i,
bool const  value = true 
)
inline

Sets the i'th bit to value.

Parameters
[in]iIndex of the bit to set.
[in]valueValue to set. Default true.
Exceptions
std::out_of_rangeif you access an element behind the last.
Returns
*this

Example

int main()
{
seqan3::dynamic_bitset t1{"10001100"};
t1.set(0);
t1.set(2, false);
seqan3::debug_stream << t1 << '\n'; // 1000'1001
}

Exception

Throws std::out_of_range if i >= size().

Complexity

Constant.

◆ size()

template<size_t bit_capacity = 58>
constexpr size_type seqan3::dynamic_bitset< bit_capacity >::size ( ) const
inlinenoexcept

Returns the number of elements in the container, i.e. std::distance(begin(), end()).

Returns
The number of elements in the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ swap() [1/2]

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::swap ( dynamic_bitset< bit_capacity > &  rhs)
inlinenoexcept

Swap contents with another instance.

Parameters
[in]rhsThe other instance to swap with.

Complexity

Linear in the size of both containers.

Exceptions

No-throw guarantee if value_type is std::is_nothrow_copy_constructible.

◆ swap() [2/2]

template<size_t bit_capacity = 58>
constexpr void seqan3::dynamic_bitset< bit_capacity >::swap ( dynamic_bitset< bit_capacity > &&  rhs)
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ test()

template<size_t bit_capacity = 58>
constexpr const_reference seqan3::dynamic_bitset< bit_capacity >::test ( size_t const  i) const
inline

Returns the i-th element.

Parameters
[in]iIndex of the element to retrieve.
Exceptions
std::out_of_rangeIf you access an element behind the last.
Returns
A reference to the value at position i.

Complexity

Constant.

Exceptions

Throws std::out_of_range if i >= size().

◆ to_string()

template<size_t bit_capacity = 58>
template<typename char_t = char>
std::string seqan3::dynamic_bitset< bit_capacity >::to_string ( char_t  zero = char_t{'0'},
char_t  one = char_t{'1'} 
) const
inline

Converts the dynamic_bitset to a std::string.

Template Parameters
char_tChar type; must model seqan3::builtin_character.
Parameters
[in]zerobuiltin_characteracter of type char_t representing false. Default '0'.
[in]onebuiltin_characteracter of type char_t representing true. Default '1'.
Exceptions
std::bad_allocfrom the the std::string constructor.
Returns
A std::string representing the dynamic_bitset.
Attention
This is the only function of this class that is not constexpr because std::string is not constexpr.

Complexity

Linear in size().

Exceptions

Throws std::bad_alloc from the std::string constructor.

◆ to_ullong()

template<size_t bit_capacity = 58>
constexpr unsigned long long seqan3::dynamic_bitset< bit_capacity >::to_ullong ( ) const
inline

Converts the dynamic_bitset to an unsigned long long integer.

Exceptions
std::overflow_errorif the value cannot be represented in unsigned long long.
Returns
A unsigned long long representing the dynamic_bitset.

Complexity

Constant.

Exceptions

Throws std::overflow_error if the value cannot be represented in unsigned long long.

◆ to_ulong()

template<size_t bit_capacity = 58>
constexpr unsigned long seqan3::dynamic_bitset< bit_capacity >::to_ulong ( ) const
inline

Converts the dynamic_bitset to an unsigned long integer.

Exceptions
std::overflow_errorif the value cannot be represented in unsigned long.
Returns
A unsigned long representing the dynamic_bitset.

Complexity

Constant.

Exceptions

Throws std::overflow_error if the value cannot be represented in unsigned long.

Friends And Related Function Documentation

◆ operator &

template<size_t bit_capacity = 58>
template<size_t cap>
constexpr dynamic_bitset operator& ( dynamic_bitset< bit_capacity > const &  lhs,
dynamic_bitset< cap > const &  rhs 
)
friend

Returns dynamic_bitset containing the result of binary AND on corresponding pairs of bits of lhs and rhs.

Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

◆ operator<< [1/2]

template<size_t bit_capacity = 58>
std::ostream& operator<< ( std::ostream os,
dynamic_bitset< bit_capacity > const &  arg 
)
friend

Formatted output for the seqan3::dynamic_bitset.

Parameters
[in,out]osThe std::basic_ostream to write to.
[in]argThe seqan3::dynamic_bitset to read from.
Returns
os.

Internally calls os << arg.to_string().

◆ operator<< [2/2]

template<size_t bit_capacity = 58>
template<typename char_t >
debug_stream_type<char_t>& operator<< ( debug_stream_type< char_t > &  s,
dynamic_bitset< bit_capacity >  arg 
)
friend

Formatted debug output for the seqan3::dynamic_bitset.

Parameters
[in,out]sThe seqan3::debug_stream to write to.
[in]argThe seqan3::dynamic_bitset to read from.
Returns
s.

Internally calls arg.to_string() and inserts a ' at every fourth position.

◆ operator>>

template<size_t bit_capacity = 58>
std::istream& operator>> ( std::istream is,
dynamic_bitset< bit_capacity > &  arg 
)
friend

Formatted input for the seqan3::dynamic_bitset.

Parameters
[in,out]isThe std::basic_istream to read from.
[out]argThe seqan3::dynamic_bitset to write to.
Returns
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.

◆ operator^

template<size_t bit_capacity = 58>
template<size_t cap>
constexpr dynamic_bitset operator^ ( dynamic_bitset< bit_capacity > const &  lhs,
dynamic_bitset< cap > const &  rhs 
)
friend

Returns dynamic_bitset containing the result of binary XOR on corresponding pairs of bits of lhs and rhs.

Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

◆ operator|

template<size_t bit_capacity = 58>
template<size_t cap>
constexpr dynamic_bitset operator| ( dynamic_bitset< bit_capacity > const &  lhs,
dynamic_bitset< cap > const &  rhs 
)
friend

Returns dynamic_bitset containing the result of binary OR on corresponding pairs of bits of lhs and rhs.

Attention
Both dynamic_bitsets must have the same size. In debug mode an assertion checks this constraint.

◆ swap

template<size_t bit_capacity = 58>
constexpr void swap ( dynamic_bitset< bit_capacity > &  lhs,
dynamic_bitset< bit_capacity > &  rhs 
)
friend

Swap contents with another instance.

Parameters
[in]lhsThe first instance.
[in]rhsThe other instance to swap with.

Complexity

Linear in the size of both containers.

Exceptions

No-throw guarantee if value_type is std::is_nothrow_copy_constructible.


The documentation for this class was generated from the following file: