summaryrefslogtreecommitdiff
path: root/include/mbgl
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2017-07-24 15:36:02 +0300
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2017-07-26 18:51:11 +0300
commitacd95c325afaf09976400d86733d26b83f28542f (patch)
tree033ae91c626ffc99bc0527fd5878fed484016131 /include/mbgl
parentcb5f498dfeb0ec0ef86ac027b29cce6f2037fd3e (diff)
downloadqtlocation-mapboxgl-acd95c325afaf09976400d86733d26b83f28542f.tar.gz
[core] Fix issues with the std:: namespace and old compilers
Specifically when building Android with GCC 4.9 (which Qt still does :-/)
Diffstat (limited to 'include/mbgl')
-rw-r--r--include/mbgl/util/string.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/mbgl/util/string.hpp b/include/mbgl/util/string.hpp
index de061647b5..82d317c620 100644
--- a/include/mbgl/util/string.hpp
+++ b/include/mbgl/util/string.hpp
@@ -1,9 +1,34 @@
#pragma once
+#include <sstream>
#include <string>
#include <cassert>
+#include <cstdlib>
#include <exception>
+// Polyfill needed by Qt when building for Android with GCC
+#if defined(__ANDROID__) && defined(__GLIBCXX__)
+
+namespace std {
+
+template <typename T>
+std::string to_string(T value)
+{
+ std::ostringstream oss;
+ oss << value;
+
+ return oss.str();
+}
+
+inline int stoi(const std::string &str)
+{
+ return atoi(str.c_str());
+}
+
+} // namespace std
+
+#endif
+
namespace mbgl {
namespace util {