class template


template < class charT,                           // basic_stringbuf::char_type           class traits = char_traits<charT>,     // basic_stringbuf::traits_type           class Alloc = allocator<charT>         // basic_stringbuf::allocator_type           > class basic_stringbuf;
String stream buffer

Stream buffer to read from and write to basic_string objects.

Objects of this class maintain internally a sequence of characters that they use as their associated input sequence and/or associated output sequence. The internal sequence can be initialized from a basic_string object, or copied to one, using member str.

Access to the internal sequence of characters is given to streams by means of the interface offered by the virtual members inherited from basic_streambuf that are overriden in this class:

Template parameters

Character type used by both the stream buffer and the basic_string objects it accepts or generates.
This shall be a non-array POD type.
Aliased as member type basic_stringbuf::char_type.
Character traits class that defines essential properties of the characters used by stream and string objects (see char_traits).
traits::char_type shall be the same as charT.
Aliased as member type basic_stringbuf::traits_type.
Type of the allocator object used to define the storage allocation model for the basic_string objects.
By default, the allocator class template is used, which defines the simplest memory allocation model and is value-independent.
Aliased as member type basic_stringbuf::allocator_type.

Template instantiations

These instantiations are declared in <sstream>.

Member types

member typedefinitionnotes
char_typeThe first template parameter (charT)
traits_typeThe second template parameter (traits)defaults to: char_traits<charT>
allocator_typeThe third template parameter (Alloc)defaults to: allocator<charT>
pos_typetraits_type::pos_typegenerally, the same as streampos
off_typetraits_type::off_typegenerally, the same as streamoff

Public member functions

Public member functions inherited from basic_streambuf

Buffer management and positioning:
Input functions (get):
Output functions (put):

Protected virtual function overrides

The class also inherits other protected members that are non-virtual or not overridden. See base class basic_streambuf for more details.