// The -*- C++ -*- type traits classes for internal use in libstdc++
-// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
namespace std
{
+ // Compare for equality of types.
+ template<typename, typename>
+ struct __are_same
+ {
+ enum
+ {
+ _M_type = 0
+ };
+ };
+
+ template<typename _Tp>
+ struct __are_same<_Tp, _Tp>
+ {
+ enum
+ {
+ _M_type = 1
+ };
+ };
+
+ // Define a nested type if some predicate holds.
+ template<typename, bool>
+ struct __enable_if
+ {
+ };
+
+ template<typename _Tp>
+ struct __enable_if<_Tp, true>
+ {
+ typedef _Tp _M_type;
+ };
+
+ // Holds if the template-argument is a void type.
template<typename _Tp>
struct __is_void
{
#pragma GCC system_header
#include <bits/c++config.h>
+#include <bits/cpp_type_traits.h>
#include <math.h>
acos(long double __x) { return ::acos(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ acos(_Tp __x)
+ {
+ return ::acos(static_cast<double>(__x));
+ }
+
using ::asin;
#if _GLIBCPP_HAVE_ASINF
asin(long double __x) { return ::asin(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ asin(_Tp __x)
+ { return ::asin(static_cast<double>(__x)); }
+
using ::atan;
#if _GLIBCPP_HAVE_ATANF
atan(long double __x) { return ::atan(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ atan(_Tp __x)
+ { return ::atan(static_cast<double>(__x)); }
+
using ::atan2;
#if _GLIBCPP_HAVE_ATAN2F
{ return ::atan2(static_cast<double>(__y), static_cast<double>(__x)); }
#endif
+ template<typename _Tp, typename _Up>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type
+ && __is_integer<_Up>::_M_type>::_M_type
+ atan2(_Tp __x, _Up __y)
+ { return ::atan2(static_cast<double>(__x), static_cast<double>(__y)); }
+
using ::ceil;
#if _GLIBCPP_HAVE_CEILF
ceil(long double __x) { return ::ceil(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ ceil(_Tp __x)
+ { return ::ceil(static_cast<double>(__x)); }
+
using ::cos;
inline float
cos(long double __x)
{ return __builtin_cosl(__x); }
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ cos(_Tp __x)
+ { return __builtin_cos(__x); }
+
using ::cosh;
#if _GLIBCPP_HAVE_COSHF
cosh(long double __x) { return ::cosh(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ cosh(_Tp __x)
+ { return ::cosh(static_cast<double>(__x)); }
+
using ::exp;
#if _GLIBCPP_HAVE_EXPF
exp(long double __x) { return ::exp(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ exp(_Tp __x)
+ { return ::exp(static_cast<double>(__x)); }
+
using ::fabs;
inline float
fabs(long double __x)
{ return __builtin_fabsl(__x); }
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ fabs(_Tp __x)
+ { return __builtin_fabs(__x); }
+
using ::floor;
#if _GLIBCPP_HAVE_FLOORF
floor(long double __x) { return ::floor(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ floor(_Tp __x)
+ { return ::floor(static_cast<double>(__x)); }
+
using ::fmod;
#if _GLIBCPP_HAVE_FMODF
{ return ::frexp(static_cast<double>(__x), __exp); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ frexp(_Tp __x, int* __exp)
+ { return ::frexp(static_cast<double>(__x), __exp); }
+
using ::ldexp;
#if _GLIBCPP_HAVE_LDEXPF
{ return ::ldexp(static_cast<double>(__x), __exp); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ ldexp(_Tp __x, int __exp)
+ { return ::ldexp(static_cast<double>(__x), __exp); }
+
using ::log;
#if _GLIBCPP_HAVE_LOGF
log(long double __x) { return ::log(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ log(_Tp __x)
+ { return ::log(static_cast<double>(__x)); }
+
using ::log10;
#if _GLIBCPP_HAVE_LOG10F
log10(long double __x) { return ::log10(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ log10(_Tp __x)
+ { return ::log10(static_cast<double>(__x)); }
+
using ::modf;
#if _GLIBCPP_HAVE_MODFF
sin(long double __x)
{ return __builtin_sinl(__x); }
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ sin(_Tp __x)
+ { return __builtin_sin(__x); }
+
using ::sinh;
#if _GLIBCPP_HAVE_SINHF
sinh(long double __x) { return ::sinh(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ sinh(_Tp __x)
+ { return ::sinh(static_cast<_Tp>(__x)); }
+
using ::sqrt;
inline float
sqrt(long double __x)
{ return __builtin_sqrtl(__x); }
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ sqrt(_Tp __x)
+ { return __builtin_sqrt(__x); }
+
using ::tan;
#if _GLIBCPP_HAVE_TANF
tan(long double __x) { return ::tan(static_cast<double>(__x)); }
#endif
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ tan(_Tp __x)
+ { return ::tan(static_cast<double>(__x)); }
+
using ::tanh;
#if _GLIBCPP_HAVE_TANHF
inline long double
tanh(long double __x) { return ::tanh(static_cast<double>(__x)); }
#endif
+
+ template<typename _Tp>
+ inline typename __enable_if<double, __is_integer<_Tp>::_M_type>::_M_type
+ tanh(_Tp __x)
+ { return ::tanh(static_cast<double>(__x)); }
}