C++11 math overloads in <math.h> on Solaris
Jonathan Wakely
jwakely@redhat.com
Tue Feb 23 11:22:00 GMT 2016
Hi Rainer,
Could you tell me whether the <math.h> on Solaris declares the
additional overloads such as acosh(float) and acosh(long double) in
C++98 mode, or only for C++11 and later?
I'm trying to fix and simplify <tr1/cmath> for PR 69893 and I think we
can get rid of most of the __CORRECT_ISO_CPP11_MATH_H_PROTO conditions
if we do it like this:
namespace std { namespace tr1 {
// For functions defined in C++03 the additional overloads are already
// declared in <cmath> so we can just re-declare them in std::tr1.
using std::acos;
using std::asin;
// etc. ...
#if __cplusplus >= 201103L
// Since C++11, <cmath> defines additional overloads for these functions
// in namespace std.
using std::acosh;
using std::asinh;
// etc. ...
#else // ! C++11
// In C++03 we need to provide the additional overloads.
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO
inline float
acosh(float __x)
{ return __builtin_acoshf(__x); }
inline long double
acosh(long double __x)
{ return __builtin_acoshl(__x); }
#endif
template<typename _Tp>
inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,
The __CORRECT_ISO_CPP11_MATH_H_PROTO isn't needed here if Solaris only
provides float and long double overloads for acosh, asinh, atanh,
cbrt, copysign etc. when __cplusplus >= 201103L.
More information about the Libstdc++
mailing list