summaryrefslogtreecommitdiff
path: root/include/mbgl/util
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-05-17 18:34:13 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-05-18 12:26:51 +0200
commitc5fc7f1980814a1063773e6c876dad66b7909adf (patch)
treeccfb86db993eca6b0ebc0b4df6f58ae80327e38f /include/mbgl/util
parent002393bdead2f036982ea3adb8a13a3d58f3428a (diff)
downloadqtlocation-mapboxgl-c5fc7f1980814a1063773e6c876dad66b7909adf.tar.gz
[core] use rapidjson's dtoa implementation to stringify floating point numbers
Diffstat (limited to 'include/mbgl/util')
-rw-r--r--include/mbgl/util/string.hpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
index d422a9d8f7..5d3631e190 100644
--- a/include/mbgl/util/string.hpp
+++ b/include/mbgl/util/string.hpp
@@ -5,6 +5,8 @@
#include <cassert>
#include <exception>
+#include <mbgl/util/dtoa.hpp>
+
namespace mbgl {
namespace util {
@@ -21,6 +23,18 @@ inline std::string toString(uint8_t num) {
return std::to_string(unsigned(num));
}
+inline std::string toString(float num) {
+ return dtoa(num);
+}
+
+inline std::string toString(double num) {
+ return dtoa(num);
+}
+
+inline std::string toString(long double num) {
+ return dtoa(num);
+}
+
inline std::string toString(std::exception_ptr error) {
assert(error);