1. to_string不能高精度输出,如:7e-10,采用如下代码输出将str输出0,而str2将输出7e-10:
#include <iomanip>
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
std::cout << fixed << std::setprecision(50) << endl;
std::string str = std::to_string(7e-10);
cout << "std::to_string(7e-10)=" << str << endl;
stringstream ss;
ss << 7e-10 << endl;
std::string str2 = ss.str();
cout << "str2=" << str2 << endl;
return 0;
}