After C++11, various cmath
functions previously in the global namespace are moved to the std
namespace, when including the
h
If functions are really missing, you have to write them yourself (or copy them from some other implementation).
In the Android NDK, some functions seem to be there, but just outside of namespace std
. I have worked around the same issue for the round
function by adding a function round
to namespace std
, which just falls back on the round
function from the global scope.
namespace std
{
inline int round(float x)
{
return ::round(x);
}
}
If you want to use this in a portable way, you would have to protect this with preprocessor macros.