floating_point_promotion.hpp 1.0 KB

12345678910111213141516171819202122232425262728
  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)
  5. #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
  6. #define FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED
  7. #include <boost/config.hpp>
  8. namespace boost {
  9. template<class T> struct floating_point_promotion { typedef T type; };
  10. template<> struct floating_point_promotion<float> { typedef double type; };
  11. template<> struct floating_point_promotion<float const> { typedef double const type; };
  12. template<> struct floating_point_promotion<float volatile>{ typedef double volatile type; };
  13. template<> struct floating_point_promotion<float const volatile> { typedef double const volatile type; };
  14. #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
  15. template <class T> using floating_point_promotion_t = typename floating_point_promotion<T>::type;
  16. #endif
  17. }
  18. #endif // #ifndef FILE_boost_type_traits_floating_point_promotion_hpp_INCLUDED