boost::dynamic_bitset::dynamic_bitset
Similar to the constructor from a basic_string, but takes a pointer to a C‐style string (and doesn't take a pos).
Synopsis
Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>
template<typename CharT>
explicit
dynamic_bitset(
CharT const* s,
std::size_t n = std::size_t( ‐1 ),
size_type num_bits = npos,
allocator_type const& alloc = allocator_type());
Description
The size of the bitset is num_bits if num_bits != npos, otherwise rlen = min( n, std::char_traits< CharT >::length( s ) ). The first M = min( num_bits, rlen ) bits are initialized to the corresponding characters in s.
Parameters
| Name | Description |
|---|---|
s |
The string to construct from. |
n |
The maximum number of characters in the string to consider. |
num_bits |
The size of the bitset to construct, if different from |
alloc |
The allocator to use. |
Preconditions
-
The characters in
sthat are used to initialize the bits compare equal to eitherstd::use_facet< std::ctype< CharT > >( std::locale() ).widen( '0' )orstd::use_facet< std::ctype< CharT > >( std::locale() ).widen( '1' ). E.g.:dynamic_bitset<> b( "10xyz", 2 ); // OK.
Created with MrDocs