std::ostringstream 转std::string

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

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

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();

猜你喜欢

转载自www.cnblogs.com/scotth/p/9446289.html
std