ostringstream provides an interface to manipulate strings as if they were output streams.
因為ostringostream is inherit from ostream.
so we can declear a output stream object , and insert value into this output object.
then we can use the method of ostringstream to manipulate the string.
以下的example是說明如何將integer轉換成string的形式.
其中針對str() 的說明為: The first version returns a copy of the string object currently associated with the string stream buffer.
int main()
{
int
abc = 123;
std::ostringstream out;
out << abc;
std::cout << out.str() << std::endl;
return 0;
}
ref : http://www.diybl.com/course/3_program/c++/cppsl/2008810/135616.html
ref : http://www.cplusplus.com/reference/iostream/ostringstream/str/