boost::dynamic_bitset::dynamic_bitset
Similar to the constructor from a pointer to a C‐style string, but takes a std::basic_string_view. This constructor is only available if the standard library provides std::basic_string_view, i.e. if the Boost.Config macro BOOST_NO_CXX17_HDR_STRING_VIEW is not defined (typically, in C++17 or later).
Synopsis
Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>
template<
typename CharT,
typename Traits>
explicit
dynamic_bitset(
std::basic_string_view<CharT, Traits> sv,
size_type num_bits = npos,
allocator_type const& alloc = allocator_type());
Description
Note that this makes the definition of dynamic_bitset depend on the C++ standard that a translation unit is compiled for, as happens with many class templates of the standard library. So, linking together translation units compiled for different standards is only safe if your implementation supports doing so for its standard library.
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. |
num_bits |
The size of the bitset to construct, if different from |
alloc |
The allocator to use. |
Preconditions
-
Each character of
svused to initialize a bit compares equal, according toTraits::eq, to eitherCharT( '0' )orCharT( '1' ). E.g.:dynamic_bitset<> b( std::string_view( "10xyz", 2 ) ); // OK.
Created with MrDocs