Skip to content

Commit 9086991

Browse files
committed
Make the descriptions of the preconditions of the three "from string" constructors more precise
1 parent 3f04ccb commit 9086991

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

include/boost/dynamic_bitset/dynamic_bitset.hpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,12 @@ class dynamic_bitset
352352
//!
353353
//! \pre
354354
//! `pos <= s.size()` and the characters used to initialize the
355-
//! bits are '0' or '1'.
355+
//! bits compare equal to either `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '0' )`
356+
//! or `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '1' )`. E.g.:
357+
//!
358+
//! \code
359+
//! dynamic_bitset<> b( std::string( "10xyz" ), 0, 2 ); // OK
360+
//! \endcode
356361
//!
357362
//! \param s The string to construct from.
358363
//! \param pos The start position in the string.
@@ -374,7 +379,13 @@ class dynamic_bitset
374379
//! to the corresponding characters in `s`.
375380
//!
376381
//! \pre
377-
//! The characters in `s` are '0' or '1'.
382+
//! The characters in `s` that are used to initialize the bits
383+
//! compare equal to either `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '0' )`
384+
//! or `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '1' )`. E.g.:
385+
//!
386+
//! \code
387+
//! dynamic_bitset<> b( "10xyz", 2 ); // OK
388+
//! \endcode
378389
//!
379390
//! \param s The string to construct from.
380391
//! \param n The maximum number of characters in the string to
@@ -394,7 +405,13 @@ class dynamic_bitset
394405
//! as C++17 or later.
395406
//!
396407
//! \pre
397-
//! The characters in `sv` are '0' or '1'.
408+
//! The characters in `sv` that are use to initialize the bits
409+
//! compare equal to either `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '0' )`
410+
//! or `std::use_facet< std::ctype< CharT > >( std::locale() ).widen( '1' )`. E.g.:
411+
//!
412+
//! \code
413+
//! dynamic_bitset<> b( std::string_view( "10xyz", 2 ) ); // OK
414+
//! \endcode
398415
//!
399416
//! \param sv The basic_string_view to construct from.
400417
//! \param num_bits The size of the bitset to construct, if

0 commit comments

Comments
 (0)