boost::to_string

Copies a representation of b into the string s.

Synopsis

Declared in <boost/dynamic_bitset/dynamic_bitset.hpp>

template<
    typename Block,
    typename AllocatorOrContainer,
    typename StringT>
void
to_string(
    dynamic_bitset<Block, AllocatorOrContainer> const& b,
    StringT& s);

Description

Character position i in the string corresponds to bit position b.size() ‐ 1 ‐ i.

Throws

An allocation error from s if memory is exhausted.

Rationale

This function is not a member function taking zero arguments and returning a string for a couple of historical reasons. First, this version could be slightly more efficient because the string is not copied. Second, as a member function, to allow for flexibility with regards to the template parameters of basic_string, the member function would require explicit template parameters. Few C++ programmers were familiar with explicit template parameters, and some C++ compilers did not handle them properly.

Parameters

Name Description

b

The bitset of which to copy the representation.

s

The string in which to copy the representation.

Created with MrDocs