3 ms·
I am very curious to know why you guys are forgetting std::to_string. It is available since c++11. This and then str.c_ctr() should make the trick in most cases
by gustavorg 5y ago
I am very curious to know why you guys are forgetting std::to_string. It is available since c++11. This and then str.c_ctr() should make the trick in most cases.
- formerly_proven 5y agoto_string uses the locale.
- jcelerier 5y agoto_string is just a wrapper around sprintf... here's the (de-__uglyfied) code on libstdc++: inline string to_string(float val) { const int n = gnu_cxx::numeric_traits<float>::max_exponent10 + 20; return gnu_cxx::to_xstring<string>(&std::vsnprintf, n, "%f", val); } it will be worse in pretty much every metric than fmt::format("{}", val);