boost::dynamic_bitset::dynamic_bitset
Similar to the constructor from a basic_string which takes zero and one, but takes a pointer to a C‐style string, or to an array of characters which need not be null‐terminated (and doesn't take a pos).
Synopsis
Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>
template<
typename CharT,
typename ZeroOne>
requires detail::dynamic_bitset_impl::is_character_type< CharT >::value && std::is_same< ZeroOne, CharT >::value
explicit
dynamic_bitset(
CharT const* s,
std::size_t n,
ZeroOne zero,
ZeroOne one = ZeroOne( '1' ),
size_type num_bits = npos,
allocator_type const& alloc = allocator_type());
Description
The same as the constructor from a pointer which doesn't take zero and one, except that the characters which stand for a zero bit and a one bit are zero and one. A null character ends the input even if it is zero or 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 |
s |
The string or array to construct from. |
n |
The maximum number of characters to read 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 |
alloc |
The allocator to use. |
Preconditions
-
‐
spoints to the first character of either a null‐terminated string or an array of at leastncharacters. ‐ Each character ofsused to initialize a bit compares equal, according tostd::char_traits< CharT >::eq, to eitherzeroorone.
Created with MrDocs