Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-02-19 06:44:34


Dave A. wrote:
> > AFAICT the logic is backwards: you should assume there's no
> > std::abs which works on long long and use your own function by
> > default, only using std::abs if the compiler is *known* to support
> > that extension... if it's even worth the trouble (it'll be less
> > code to just do the whole thing yourself).

Point taken.
 
Markus S. wrote:
> Looks like there a two cases which would need two macros.
>
> - BOOST_NO_STD_ABS identifies that no std::abs is available.
>
> - BOOST_HAS_STD_ABS_LONG_LONG identifies that the compiler provides a
> long long overload for std::abs.
>
> Those macro names follow the general macro naming convention, I think.
>
> The easiest thing would probably be to just say
>
> namespace whatever { inline template <class T> T abs(T) { ... } }
>
> and use this, as Dave suggested.

I think I'm inclined to take Dave's last suggestion, rename
the template function and remove all the macros.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk