floating_point_promotion.qbk 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. [/
  2. Copyright 2007 John Maddock.
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt).
  6. ]
  7. [section:floating_point_promotion floating_point_promotion]
  8. template <class T>
  9. struct floating_point_promotion
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using floating_point_promotion_t = typename floating_point_promotion<T>::type; // C++11 and above
  14. __type If floating point promotion can be applied to an rvalue of type `T`,
  15. then applies floating point promotion to `T` and keeps cv-qualifiers of `T`,
  16. otherwise leaves `T` unchanged.
  17. __std_ref 4.6.
  18. __header ` #include <boost/type_traits/floating_point_promotion.hpp>` or ` #include <boost/type_traits.hpp>`
  19. [table Examples
  20. [ [Expression] [Result Type]]
  21. [[`floating_point_promotion<float const>::type`][`double const`]]
  22. [[`floating_point_promotion<float&>::type`][`float&`]]
  23. [[`floating_point_promotion<short>::type`][`short`]]
  24. ]
  25. [all_compilers]
  26. [endsect]