promote.qbk 1.0 KB

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