Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
ToDouble is a conversion code snippet to convert a std::string to double.
ToDouble can be implemented in multiple equivalent ways (incomplete list):
To conversion a std::string to any data type one can use LexicalCast and boost::lexical_cast.
#include <cstdlib> |
The implementation below is similar to the C++ FAQ Lite's convertToDouble code snippet.
#include <sstream> |
#include <cstdlib> |
In the code below, all ToDouble flavors are compared and found out equivalent.
#include <algorithm> |
Screen output:
+67.3: 67.3 |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.