Boost logo

Boost Users :

Subject: Re: [Boost-users] [STL] Is there a std::abs<>() function?
From: Anteru (newsgroups_at_[hidden])
Date: 2008-12-23 06:00:56


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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net