Boost logo

Boost :

From: Daniel James (daniel_at_[hidden])
Date: 2005-04-19 13:00:21

Hubert Holin wrote:
> Do we have some template metamagic to see if a given function
> signature is available? I had intended to test computation accuracy for
> some select values and compare with epsilon for that type (could still
> use it to check for QOI anyway...).

You can see my crude attempt at this at:

I use the return type of the function to tell which overload was called.
It's a bit odd on Solaris though, as both GCC and the Sun compiler seem
to have the standard overloads, but my tests fail on GCC which suggests
that the GCC long double overload doesn't have the full accuracy.

Anyway, the following might be what you want. But I think some config
macros, with good test cases, would be better.

#include "boost/type_traits/detail/yes_no_type.hpp"
#include <cmath>

boost::type_traits::no_type is_long_double(double);
boost::type_traits::yes_type is_long_double(long double);

const bool has_long_double_frexp
     = sizeof(is_long_double(std::frexp((long double) 0.0, 1)))
         == sizeof(boost::type_traits::yes_type);

Boost list run by bdawes at, gregod at, cpdaniel at, john at