boost::dynamic_bitset::dynamic_bitset

Similar to the constructor from a basic_string which takes zero and one, but takes a std::basic_string_view (and no pos or n). Like the constructor from a basic_string_view which doesn't take zero and one, it is only available if the Boost.Config macro BOOST_NO_CXX17_HDR_STRING_VIEW is not defined.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

template<
    typename CharT,
    typename Traits,
    typename ZeroOne>
requires detail::dynamic_bitset_impl::is_character_type< CharT >::value && std::is_same< ZeroOne, CharT >::value
explicit
dynamic_bitset(
    std::basic_string_view<CharT, Traits> sv,
    ZeroOne zero,
    ZeroOne one = ZeroOne( '1' ),
    size_type num_bits = npos,
    allocator_type const& alloc = allocator_type());

Description

The same as that constructor, except that the characters which stand for a zero bit and a one bit are zero and one. This constructor participates in overload resolution under the same conditions as the constructor from a basic_string which takes zero and one.

Throws

An allocation error if memory is exhausted (std::bad_alloc if allocator_type is a std::allocator).

Parameters

Name

Description

sv

The basic_string_view to construct from.

zero

The character which stands for a zero bit.

one

The character which stands for a one bit.

num_bits

The size of the bitset to construct, if different from npos. (Otherwise the size of the bitset is sv.length().)

alloc

The allocator to use.

Preconditions

  • Each character of sv used to initialize a bit compares equal, according to Traits::eq, to either zero or one.

Created with MrDocs