<sstream>

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at <sstream>.

Defines several template classes that support iostreams operations on sequences stored in an allocated array object. Such sequences are easily converted to and from objects of template class basic_string.

namespace std {
template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_stringbuf;
typedef basic_stringbuf<char>  
stringbuf;
typedef basic_stringbuf<wchar_t> wstringbuf;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_istringstream;
typedef basic_istringstream<char>  
istringstream;
typedef basic_istringstream<wchar_t> wistringstream;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_ostringstream;
typedef basic_ostringstream<char>  
ostringstream;
typedef basic_ostringstream<wchar_t> wostringstream;

template <class CharType, class Traits = char_traits<CharType>, class Allocator = allocator<CharType>>
class basic_stringstream;
typedef basic_stringstream<char>  
stringstream;
typedef basic_stringstream<wchar_t> wstringstream;
// TEMPLATE FUNCTIONS
template <class CharType, class Traits, class Allocator>
void swap(
    basic_stringbuf<CharType, Traits, Allocator>& left,
    basic_stringbuf<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap(
    basic_istringstream<CharType, Traits, Allocator>& left,
    basic_istringstream<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap(
    basic_ostringstream<CharType, Traits, Allocator>& left,
    basic_ostringstream<CharType, Traits, Allocator>& right);

template <class CharType, class Traits, class Allocator>
void swap (
    basic_stringstream<CharType, Traits, Allocator>& left,
    basic_stringstream<CharType, Traits, Allocator>& right);

}  // namespace std

Parameters

ParameterDescription
leftReference to an sstream object.
rightReference to an sstream object.

Objects of type char * can use the functionality in <strstream> for streaming. However, <strstream> is deprecated and the use of <sstream> is encouraged.

Typedefs

istringstreamCreates a type basic_istringstream specialized on a char template parameter.
ostringstreamCreates a type basic_ostringstream specialized on a char template parameter.
stringbufCreates a type basic_stringbuf specialized on a char template parameter.
stringstreamCreates a type basic_stringstream specialized on a char template parameter.
wistringstreamCreates a type basic_istringstream specialized on a wchar_t template parameter.
wostringstreamCreates a type basic_ostringstream specialized on a wchar_t template parameter.
wstringbufCreates a type basic_stringbuf specialized on a wchar_t template parameter.
wstringstreamCreates a type basic_stringstream specialized on a wchar_t template parameter.

Manipulators

swapExchanges the values between two sstream objects.

Classes

basic_stringbufDescribes a stream buffer that controls the transmission of elements of type Elem, whose character traits are determined by the class Tr, to and from a sequence of elements stored in an array object.
basic_istringstreamDescribes an object that controls extraction of elements and encoded objects from a stream buffer of class basic_stringbuf<Elem, Tr, Alloc>, with elements of type Elem, whose character traits are determined by the class Tr, and whose elements are allocated by an allocator of class Alloc.
basic_ostringstreamDescribes an object that controls insertion of elements and encoded objects into a stream buffer of class basic_stringbuf<Elem, Tr, Alloc>, with elements of type Elem, whose character traits are determined by the class Tr, and whose elements are allocated by an allocator of class Alloc.
basic_stringstreamDescribes an object that controls insertion and extraction of elements and encoded objects using a stream buffer of class basic_stringbuf<Elem, Tr, Alloc>, with elements of type Elem, whose character traits are determined by the class Tr, and whose elements are allocated by an allocator of class Alloc.
  • Header: <sstream>

  • Namespace: std

Header Files Reference
Thread Safety in the C++ Standard Library
iostream Programming
iostreams Conventions

Show: