[STL] Is there a std::abs<>() function?
Hello,
It's strange to me that there seems not to be a std::abs<>() function
in STL, with it I can write code like this:
double d = std::abs(-1.0);
int i = std::abs(-1);
Does anybody else have the same feeling?
Being uncomfortable with the abcence of it, I've wrote my own version
in my namespace:
#include
Max schrieb:
Hello,
It's strange to me that there seems not to be a std::abs<>() function in STL, with it I can write code like this:
double d = std::abs(-1.0); int i = std::abs(-1);
Does anybody else have the same feeling?
#include <cmath> double d = std::abs (-1.0); cmath pulls the standard math functions into the std namespace, and adds a few overloads. See for example: http://www.dinkumware.com/manuals/?manual=compleat&page=math.html#abs Cheers, Anteru
participants (2)
-
Anteru
-
Max