namespace std { template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> > class basic_stringstream : public basic_iostream<charT,traits> { public: // types: typedef charT char_type; typedef typename traits::int_type int_type; typedef typename traits::pos_type pos_type; typedef typename traits::off_type off_type; typedef traits traits_type; typedef Allocator allocator_type; // constructors/destructor explicit basic_stringstream( ios_base::openmode which = ios_base::out|ios_base::in); explicit basic_stringstream( const basic_string<charT,traits,Allocator>& str, ios_base::openmode which = ios_base::out|ios_base::in); basic_stringstream(const basic_stringstream& rhs) = delete; basic_stringstream(basic_stringstream&& rhs); // [stringstream.assign] Assign/swap: basic_stringstream& operator=(const basic_stringstream& rhs) = delete; basic_stringstream& operator=(basic_stringstream&& rhs); void swap(basic_stringstream& rhs); // Members: basic_stringbuf<charT,traits,Allocator>* rdbuf() const; basic_string<charT,traits,Allocator> str() const; void str(const basic_string<charT,traits,Allocator>& str); private: basic_stringbuf<charT, traits> sb; // exposition only }; template <class charT, class traits, class Allocator> void swap(basic_stringstream<charT, traits, Allocator>& x, basic_stringstream<charT, traits, Allocator>& y); }
The class template basic_stringstream<charT, traits> supports reading and writing from objects of class basic_string<charT, traits, Allocator>. It uses a basic_stringbuf<charT, traits, Allocator> object to control the associated sequence. For the sake of exposition, the maintained data is presented here as
sb, the stringbuf object.