1 // Copyright 2005 Alexander Nasonov.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
7 #define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
9 #include <boost/config.hpp>
11 #ifdef BOOST_NO_CV_SPECIALIZATIONS
12 #include <boost/mpl/at.hpp>
13 #include <boost/mpl/int.hpp>
14 #include <boost/mpl/multiplies.hpp>
15 #include <boost/mpl/plus.hpp>
16 #include <boost/mpl/vector.hpp>
17 #include <boost/type_traits/is_same.hpp>
20 // Should be the last #include
21 #include <boost/type_traits/detail/type_trait_def.hpp>
25 namespace type_traits { namespace detail {
27 #ifndef BOOST_NO_CV_SPECIALIZATIONS
30 struct floating_point_promotion
36 struct floating_point_promotion<float>
42 struct floating_point_promotion<float const>
44 typedef double const type;
48 struct floating_point_promotion<float volatile>
50 typedef double volatile type;
54 struct floating_point_promotion<float const volatile>
56 typedef double const volatile type;
62 struct floating_point_promotion
64 mpl::vector< T, double, double const, double volatile,
65 double const volatile >
68 , mpl::multiplies< is_same<T, float const> , mpl::int_<2> >
69 , mpl::multiplies< is_same<T, float volatile> , mpl::int_<3> >
70 , mpl::multiplies< is_same<T, float const volatile>, mpl::int_<4> >
80 BOOST_TT_AUX_TYPE_TRAIT_DEF1(
81 floating_point_promotion
83 , BOOST_DEDUCED_TYPENAME
84 boost::type_traits::detail::floating_point_promotion<T>::type
88 #include <boost/type_traits/detail/type_trait_undef.hpp>
90 #endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED