[core] Use std::to_string on Windows

Clang on Window's can't parse rapidjson's dtoa.
This commit is contained in:
Thiago Marcos P. Santos
2016-08-06 01:15:50 +03:00
committed by Thiago Marcos P. Santos
parent 3b49ec3a0b
commit 0d7d3d8959
2 changed files with 14 additions and 1 deletions

View File

@@ -1,10 +1,16 @@
#include "dtoa.hpp"
// Clang/C2 on Windows 64-bits can't parse rapidjson's dtoa
// and it was causing the compiler to crash.
#if !defined(_WINDOWS)
#include <rapidjson/internal/dtoa.h>
#endif
namespace mbgl {
namespace util {
#if !defined(_WINDOWS)
namespace {
// From https://github.com/miloyip/rapidjson/blob/master/include/rapidjson/internal/dtoa.h
@@ -101,5 +107,13 @@ std::string dtoa(double value) {
return data;
}
#else
std::string dtoa(double value) {
return std::to_string(value);
}
#endif
} // namespace util
} // namespace mbgl

View File

@@ -5,7 +5,6 @@
namespace mbgl {
namespace util {
char* dtoa(double value, char* buffer);
std::string dtoa(double value);
} // end namespace util