1 // (C) Copyright John Maddock 2005.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BOOST_TR1_MATH_OVERLOADS_HPP_INCLUDED
7 # define BOOST_TR1_MATH_OVERLOADS_HPP_INCLUDED
8 # include <boost/config.hpp>
10 # ifndef BOOST_NO_SFINAE
11 # include <boost/utility/enable_if.hpp>
12 # include <boost/type_traits/is_convertible.hpp>
13 # define BOOST_TR1_MATH_RETURN(RET) typename ::boost::enable_if< ::boost::is_convertible<T,double>, RET >::type
15 # define BOOST_TR1_MATH_RETURN(RET) RET
18 # include <boost/type_traits/is_floating_point.hpp>
19 # include <boost/type_traits/is_same.hpp>
20 # include <boost/mpl/if.hpp>
22 namespace boost{ namespace tr1_detail{
24 template <class T, class U>
27 typedef typename boost::mpl::if_<
28 boost::is_same<long double, T>,
30 typename boost::mpl::if_<
31 boost::is_same<long double, U>,
33 typename boost::mpl::if_<
34 boost::is_same<double, T>,
36 typename boost::mpl::if_<
37 boost::is_same<double, U>,
46 template <class T, class U>
47 struct promote_to_real
49 typedef typename largest_real<
50 typename boost::mpl::if_< boost::is_floating_point<T>, T, double>::type,
51 typename boost::mpl::if_< boost::is_floating_point<U>, U, double>::type