std::ostringstream 转std::string

http://www.cplusplus.com/reference/sstream/ostringstream/

https://en.cppreference.com/w/cpp/io/basic_stringstream

https://www.cnblogs.com/hdk1993/p/5853233.html

https://blog.csdn.net/qq1987924/article/details/7671154

template<class T>

void to_string(string & result,const T& t)

{

ostringstream oss;//创建一个流

oss<<t;//把值传递如流中

result=oss.str();//获取转换后的字符转并将其写入result
}

std::ostringstream os;
BigInt c;
os << c;
std::string str = os.str();
posted @ 2018-08-08 22:58  scott_h  阅读(1140)  评论(0编辑  收藏  举报