boost::operator<<

Inserts a textual representation of b into the stream os, highest bit first.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

template<
    typename CharT,
    typename Traits,
    typename Block,
    typename AllocatorOrContainer>
std::basic_ostream<CharT, Traits>&
operator<<(
    std::basic_ostream<CharT, Traits>& os,
    dynamic_bitset<Block, AllocatorOrContainer> const& b);

Description

Informally, the output is the same as:

std::basic_string<Char, Traits> s;
boost::to_string(x, s):
os << s;

except that the stream inserter takes into accout the locale imbued into os, which boost::to_string() can't do. More precisely: First, for each valid position i into the bitset b let's put: character_of( b[ i ) ] ) = b[ i ] ? os.widen( '1' ) : os.widen( '0' );. Let also s be a std::basic_string<Char, Traits> object, having length b.size() and such that, for each i in [0, b.size()), s[ i ] is character_of( b[ i ] ). Then, the output, the effects on os and the exception behavior is the same as outputting the object s to os (same width, same exception mask, same padding, same setstate() logic.)

Return Value

os.

Parameters

Name Description

os

An output stream

b

The object to output

Created with MrDocs