diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/util/string.hpp | 25 |
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 { |