summaryrefslogtreecommitdiff
path: root/include/mbgl/util/string.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/util/string.hpp')
-rw-r--r--include/mbgl/util/string.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
index 82d317c620..13498ccb92 100644
--- a/include/mbgl/util/string.hpp
+++ b/include/mbgl/util/string.hpp
@@ -25,6 +25,10 @@ inline int stoi(const std::string &str)
return atoi(str.c_str());
}
+inline float stof(const std::string &str) {
+ return static_cast<float>(atof(str.c_str()));
+}
+
} // namespace std
#endif
@@ -65,5 +69,9 @@ inline std::string toString(std::exception_ptr error) {
}
}
+inline float stof(const std::string& str) {
+ return std::stof(str);
+}
+
} // namespace util
} // namespace mbgl