Namespaces
Variants

std::basic_stringbuf

From cppreference.com
< cpp | io
 
 
 
 
Defined in header <sstream>
template<
    class CharT,
    class Traits = std::char_traits<CharT>,
    class Allocator = std::allocator<CharT>
> class basic_stringbuf
    : public std::basic_streambuf<CharT, Traits>

std::basic_stringbuf is a std::basic_streambuf whose associated character sequence is a memory-resident sequence of arbitrary characters, which can be initialized from or made available as an instance of std::basic_string.

Typical implementations of std::basic_stringbuf hold an object of type std::basic_string or equivalent resizable sequence container directly as a data member and use it as both the controlled character sequence (the array where the six pointers of std::basic_streambuf are pointing to) and as the associated character sequence (the source of characters for all input operations and the target for the output).

In addition, a typical implementation holds a data member of type std::ios_base::openmode to indicate the I/O mode of the associated stream (input-only, output-only, input/output, at-end, etc).

If over-allocation strategy is used by overflow(), an additional high-watermark pointer may be stored to track the last initialized character.