71 lines
1.5 KiB
C++
71 lines
1.5 KiB
C++
/*
|
||
* © Copyright 2014 – Urheberrechtshinweis
|
||
* Alle Rechte vorbehalten / All Rights Reserved
|
||
*
|
||
* Programmcode ist urheberrechtlich geschuetzt.
|
||
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
|
||
* Keine Verwendung ohne explizite Genehmigung.
|
||
* (vgl. § 106 ff UrhG / § 97 UrhG)
|
||
*/
|
||
|
||
#ifndef FIXC11_H
|
||
#define FIXC11_H
|
||
|
||
#ifdef ANDROID
|
||
|
||
#include <cmath>
|
||
#include <sstream>
|
||
#include <cstdio>
|
||
|
||
namespace std {
|
||
|
||
//template <typename T> T sqrt(const T val) {return ::sqrt(val);}
|
||
|
||
|
||
//}
|
||
|
||
template <typename T> inline string to_string(const T val) {
|
||
stringstream ss;
|
||
ss << val;
|
||
return ss.str();
|
||
}
|
||
|
||
template <typename T> inline T round(const T val) {
|
||
return ::round(val);
|
||
}
|
||
|
||
// http://stackoverflow.com/questions/19478687/no-member-named-stoi-in-namespace-std
|
||
inline int stoi(const std::string& str) {
|
||
std::istringstream is(str);
|
||
int val; is >> val; return val;
|
||
}
|
||
|
||
// analog zu oben
|
||
inline float stof(const std::string& str) {
|
||
std::istringstream is(str);
|
||
float val; is >> val; return val;
|
||
}
|
||
|
||
// analog zu oben
|
||
inline double stod(const std::string& str) {
|
||
std::istringstream is(str);
|
||
double val; is >> val; return val;
|
||
}
|
||
|
||
// analog zu oben
|
||
inline uint64_t stol(const std::string& str) {
|
||
std::istringstream is(str);
|
||
uint64_t val; is >> val; return val;
|
||
}
|
||
|
||
// inline int sprintf(char* str, const char * format, ...) {
|
||
// //return ::sprintf(str, format, ...);
|
||
// return 0;
|
||
// }
|
||
|
||
}
|
||
|
||
#endif
|
||
|
||
#endif // FIXC11_H
|