Standard C++ Library Reference ISO/IEC (VERSION3)

bitset::to_string
template<class Elem, class Tr, class Alloc>
basic_string<Elem, Tr, Alloc> to_string() const;
The member function constructs str, an object of class basic_string<Elem, Tr,
Alloc>. For each bit in the bit sequence, the function appends 1 if the bit is set, otherwise 0.
The last element appended to str corresponds to bit position zero. The function returns str.
bitset::to_ulong
unsigned long to_ulong() const;
The member function throws overflow_error if any bit in the bit sequence has a bit value
that cannot be represented as a value of type unsigned long. Otherwise, it returns the sum of the
bit values in the bit sequence.
operator<<
template<class Elem, class Tr, size_t Bits>
basic_ostream<Elem, Tr>&
operator<<(basic_ostream<Elem, Tr>& ostr,
const bitset<Bits>& right);
The template function overloads operator<< to insert a text representation of the bit sequence
in ostr. It effectively executes ostr << right.to_string<Elem, Tr,
allocator<Elem> >(), then returns ostr.
operator>>
template<class Elem, class Tr, size_t Bits>
basic_istream<Elem, Tr>&
operator>>(basic_istream<Elem, Tr>& istr,
bitset<Bits>& right);
The template function overloads operator>> to store in right the value bitset(str),
where str is an object of type basic_string<Elem, Tr, allocator<Elem> >&
extracted from istr. The function extracts elements and appends them to str until:
Bits elements have been extracted and stored
end-of-file occurs on the input sequence
the next input element is neither 0 nor 1, in which case the input element is not extracted
If the function stores no characters in str, it calls
istr.setstate(ios_base::failbit). In any case, it returns istr.