45template <
class InType>
49 std::ostringstream oss;
50 oss.imbue(std::locale::classic());
65template <
class OutType>
69 std::istringstream stream(s);
70 stream.imbue(std::locale::classic());
73 if (stream.fail() || !stream.eof())
75 throw std::runtime_error(
"Failed converting string to real number");
82 return toRealImpl<double>(s);
87 return toRealImpl<float>(s);
locale-agnostic conversion functions from floating point numbers to strings
float toFloat(const std::string &s)
Converts a std::string to float using the classic C locale.
double toDouble(const std::string &s)
Converts a std::string to double using the classic C locale.
std::string toString(double d)
Convert a double to std::string using the classic C locale.
OutType toRealImpl(const std::string &s)
std::string toStringImpl(InType t)
Main namespace for MoveIt.