C++11 std::to_string(double) - No trailing zeros

前端 未结 9 1807
孤城傲影
孤城傲影 2020-12-01 06:04

Today I tried out some new functions of the C++11 STL and encountered std::to_string.

Lovely, lovely set of functions. Creating a stringstream object fo

9条回答
  •  萌比男神i
    2020-12-01 06:45

    std::to_string(double) is defined by the standard to just return the same sequence of characters that would be generated by sprintf(buf, "%f", value). No more, no less, especially no way to tweak the format specifier. So no, there is nothing you can do.

提交回复
热议问题