integral_promotion.qbk 1010 B

123456789101112131415161718192021222324252627282930313233343536373839
  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:integral_promotion integral_promotion]
  8. template <class T>
  9. struct integral_promotion
  10. {
  11. typedef __below type;
  12. };
  13. template <class T> using integral_promotion_t = typename integral_promotion<T>::type; // C++11 and above
  14. __type If integral promotion can be applied to an rvalue of type `T`, then
  15. applies integral promotion to `T` and keeps cv-qualifiers of `T`,
  16. otherwise leaves `T` unchanged.
  17. __std_ref 4.5 except 4.5/3 (integral bit-field).
  18. __header ` #include <boost/type_traits/integral_promotion.hpp>` or ` #include <boost/type_traits.hpp>`
  19. [table Examples
  20. [ [Expression] [Result Type]]
  21. [[`integral_promotion<short const>::type`][`int const`]]
  22. [[`integral_promotion<short&>::type`][`short&`]]
  23. [[`integral_promotion<enum std::float_round_style>::type`][`int`]]
  24. ]
  25. [endsect]