summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-10-29 12:07:07 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-10-29 12:07:07 +0100
commit319762f15075b7c80812b578a0da613cf867b9f2 (patch)
tree8a1b354e25a5931326aecaadbaac7f705ba2a70a /src
parent12b08ae49154379f7471a40809ace6418857b387 (diff)
Added Android support using the GNU C++ STL library and the GCC toolchain
Diffstat (limited to 'src')
-rw-r--r--src/clpp11.hpp5
-rw-r--r--src/utilities/android.hpp7
2 files changed, 9 insertions, 3 deletions
diff --git a/src/clpp11.hpp b/src/clpp11.hpp
index 0cdd92e7..82fc44fd 100644
--- a/src/clpp11.hpp
+++ b/src/clpp11.hpp
@@ -53,6 +53,11 @@
#include <CL/opencl.h>
#endif
+// Android support (missing C++11 functions to_string, stod, and stoi)
+#ifdef __ANDROID__
+ #include "utilities/android.hpp"
+#endif
+
// Exception classes
#include "cxpp11_common.hpp"
diff --git a/src/utilities/android.hpp b/src/utilities/android.hpp
index c14f92f3..64e9b3f4 100644
--- a/src/utilities/android.hpp
+++ b/src/utilities/android.hpp
@@ -7,7 +7,8 @@
// Author(s):
// Cedric Nugteren <www.cedricnugteren.nl>
//
-// This file provides macro's and definitions to make compilation work for Android.
+// This file provides macro's and definitions to make compilation work for Android. Note that this
+// header should only be included when compiling for Android, e.g. when __ANDROID__ is defined.
//
// =================================================================================================
@@ -22,7 +23,7 @@
namespace std {
-// No support for these standard library functions when compiling with 'gnustl_cpp'
+// No support for these standard library functions when compiling with the GNU C++ STL
template<typename T>
std::string to_string(T value) {
std::ostringstream os;
@@ -30,7 +31,7 @@ std::string to_string(T value) {
return os.str();
}
inline double stod(const std::string& value) {
- return -1.0; // Not implemented
+ return std::atof(value.c_str());
}
inline int stoi( const std::string& str, std::size_t* pos = 0, int base = 10) {
char * p_end;