-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: fmt::to_string
#326
Comments
Good idea. It can even be implemented in a more efficient way than template <typename T>
std::string to_string(const T &value) {
fmt::MemoryWriter w;
w << value;
return w.str();
} Or, even better, writing directly to |
Done in b6c0cf9. |
It's documented here: http://fmtlib.net/dev/api.html#_CPPv2N3fmt9to_stringERK1T |
Could you please add fmt::to_wstring as well? |
@alabuzhev Would you be willing to submit a pull request along the lines of b6c0cf9? =) |
The former is faster. More info: fmtlib/fmt#326 Signed-off-by: Rosen Penev <rosenp@gmail.com>
The former is faster. More info: fmtlib/fmt#326 Signed-off-by: Rosen Penev <rosenp@gmail.com>
Basically the same as
std::to_string
. It should not be hard to implement as it is functionally equivalent tofmt::format("{}", XXX)
. Reasons that I would like to usefmt::to_string
in lieu ofstd::to_string
:std::to_string
is not available on C++03.std::to_string
is horrendously slow on some implementations. Last time I checked, MSVC internally creates astringstream
for everystd::to_string
call.The text was updated successfully, but these errors were encountered: