std::ostringstream (3) - Linux Manuals
std::ostringstream: std::basic_ostringstream
NAME
std::basic_ostringstream - std::basic_ostringstream
Synopsis
Defined in header <sstream>
template<
class CharT, (until C++11)
class Traits = std::char_traits<CharT>
> class basic_ostringstream;
template<
class CharT,
class Traits = std::char_traits<CharT>, (since C++11)
class Allocator = std::allocator<CharT>
> class basic_ostringstream;
The class template std::basic_ostringstream implements output operations on memory (std::basic_string) based streams. It essentially wraps a raw string device implementation (std::basic_stringbuf) into a higher-level interface (std::basic_ostream). The complete interface to unique std::basic_stringbuf members is provided.
std-basic ostringstream-inheritance.svg
Inheritance diagram
Two specializations for common character types are also defined:
Defined in header <sstream>
Type Definition
ostringstream basic_ostringstream<char>
wostringstream basic_ostringstream<wchar_t>
Member types
Member type Definition
char_type CharT
traits_type Traits; the program is ill-formed if Traits::char_type is not CharT.
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
allocator_type Allocator (since C++11)
Member functions
constructor (public member function)
operator= moves the string stream
(C++11)
swap swaps two string streams
(C++11)
rdbuf (public member function)
String operations
str (public member function)
Non-member functions
std::swap(std::basic_ostringstream) specializes the std::swap algorithm
(C++11)
Inherited from std::basic_ostream
Member functions
Formatted output
operator<< (public member function of std::basic_ostream<CharT,Traits>)
Unformatted output
put (public member function of std::basic_ostream<CharT,Traits>)
write (public member function of std::basic_ostream<CharT,Traits>)
Positioning
tellp (public member function of std::basic_ostream<CharT,Traits>)
seekp (public member function of std::basic_ostream<CharT,Traits>)
Miscellaneous
flush (public member function of std::basic_ostream<CharT,Traits>)
Member classes
sentry (public member class of std::basic_ostream<CharT,Traits>)
Inherited from std::basic_ios
Member types
Member type Definition
char_type CharT
traits_type Traits
int_type Traits::int_type
pos_type Traits::pos_type
off_type Traits::off_type
Member functions
State functions
good (public member function of std::basic_ios<CharT,Traits>)
eof (public member function of std::basic_ios<CharT,Traits>)
fail (public member function of std::basic_ios<CharT,Traits>)
bad (public member function of std::basic_ios<CharT,Traits>)
operator! (public member function of std::basic_ios<CharT,Traits>)
operator_void*
operator_bool checks if no error has occurred (synonym of !fail())