basic_string<char_type,traits_type,allocator_type> str() const;void str (const basic_string<char_type,traits_type,allocator_type>& s);
123456789101112
// stringstream::str #include <string> // std::string #include <iostream> // std::cout #include <sstream> // std::stringstream, std::stringbuf int main () { std::stringstream ss; ss.str ("Example string"); std::string s = ss.str(); std::cout << s << '\n'; return 0; }
Example string