This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
YASMIN/misc/fixc11.h
2016-07-15 16:39:38 +02:00

55 lines
1.0 KiB
C++

#ifndef FIXC11_H
#define FIXC11_H
#ifdef ANDROID
#include <cmath>
#include <sstream>
namespace std {
//template <typename T> T sqrt(const T val) {return ::sqrt(val);}
//}
template <typename T> string to_string(const T val) {
stringstream ss;
ss << val;
return ss.str();
}
template <typename T> T round(const T val) {
return ::round(val);
}
// http://stackoverflow.com/questions/19478687/no-member-named-stoi-in-namespace-std
int stoi(const std::string& str) {
std::istringstream is(str);
int val; is >> val; return val;
}
// analog zu oben
float stof(const std::string& str) {
std::istringstream is(str);
float val; is >> val; return val;
}
// analog zu oben
double stod(const std::string& str) {
std::istringstream is(str);
double val; is >> val; return val;
}
// analog zu oben
uint64_t stol(const std::string& str) {
std::istringstream is(str);
uint64_t val; is >> val; return val;
}
}
#endif
#endif // FIXC11_H