to_string函數主要進行以下一些參數轉換為string
stringstream,位於<sstream>庫中
https://blog.csdn.net/jllongbell/article/details/79092891
<sstream>庫定義了三種類:istringstream、ostringstream和stringstream,分別用來進行流的輸入、輸出和輸入輸出操作。
1.stringstream::str(); returns a string object with a copy of the current contents of the stream.
2.stringstream::str (const string& s); sets s as the contents of the stream, discarding any previous contents.
3.stringstream清空,stringstream s; s.str("");
4.實現任意類型的轉換
template<typename out_type, typename in_value>
out_type convert(const in_value & t){
stringstream stream;
stream<<t;//向流中傳值
out_type result;//這里存儲轉換結果
stream>>result;//向result中寫入值
return result;
}