-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use the standard to_string() functions for C++11 #4279
Conversation
👍 |
Code looks good. What about moving the functions |
no, we shouldn't mess with the std namespace more than we should. @Rogier-5 only added the to_string functions to std because they already exist in c++11. |
Warning, there is a big difference it our implementation & stdlib implementation. std::to_string throw exception when to_string failed |
I'm investigating the failing travis check. The test failures are on OSX only, in test_map_settings_manager.cpp and test_settings.cpp. However, I can't seem to find the specifications of those test cases. Am I overlooking them, or are they hidden somewhere ? |
@nerzhul From what I read, to_string only throws when the Or am I missing something obvious, or maybe less obvious, here ? |
Well it doesn't have to be perfect, it only has to work. |
So it seems in some implementations, |
@dlaboratory I checked the c++11 standard, and this behaviour is actually in accordance with the standard... It says that It seams that Te be continued... |
Removing my approval. Seems this PR should be closed? We do want the %G format. Maybe we could rename the to_string function to something different so that nobody mixes the two up. |
If compiling according to a C++ version before C++11, then define std::to_string ourselves. Add a to_wstring version as well As std::to_string() for floating point types uses %.6f as floating point format converter, instead of %G, it needs special care. To preserve ftos() behavior (which is expected to use the %G format converter), it no longer uses to_string().
The revised patch still replaces |
The problems with the previous version have been fixed, and all tests pass. |
Ah no, overriding the behaviour of std function templates is not a good way to do things. |
@est31 I don't quite understand what you mean. Are you objecting to the overriding of function templates per sé, regardless of where they are, are you objecting because they are in Obviously, the functions have to be in If you don't like the overriding of template functions at all, I can define every necessary |
Sorry, seems I've misunderstood something. Its good. 👍 |
Okay for me |
(taking @nerzhul 's "okay for me" as 👍 ) |
If compiling according to a C++ version before C++11, then define
std::to_string ourselves.
Add a to_wstring version as well