Use strtod instead of strtof because VC++ doesn't support it

This commit is contained in:
Jon Daniel 2012-05-05 04:42:04 +00:00
parent e70fdc4c7d
commit ce50d6bedc

View File

@ -253,7 +253,7 @@ template<>
float lexical_cast<float, const std::string&>(const std::string& a)
{
char* endptr;
float res = strtof(a.c_str(), &endptr);
float res = static_cast<float>(strtod(a.c_str(), &endptr));
if (a.empty() || *endptr != '\0') {
throw bad_lexical_cast();
@ -266,7 +266,7 @@ template<>
float lexical_cast<float, const char*>(const char* a)
{
char* endptr;
float res = strtof(a, &endptr);
float res = static_cast<float>(strtod(a, &endptr));
if (*a == '\0' || *endptr != '\0') {
throw bad_lexical_cast();
@ -278,7 +278,7 @@ template<>
float lexical_cast_default<float, const std::string&>(const std::string& a, float def)
{
char* endptr;
float res = strtof(a.c_str(), &endptr);
float res = static_cast<float>(strtod(a.c_str(), &endptr));
if (a.empty() || *endptr != '\0') {
return def;;
@ -291,7 +291,7 @@ template<>
float lexical_cast_default<float, const char*>(const char* a, float def)
{
char* endptr;
float res = strtof(a, &endptr);
float res = static_cast<float>(strtod(a, &endptr));
if (*a == '\0' || *endptr != '\0') {
return def;