...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template <class T>
struct promote
{
typedef see-below
type;
};
template <class T> using promote_t = typename promote<T>::type; // C++11 and above
type: If integral or floating point promotion
can be applied to an rvalue of type T
,
then applies integral and floating point promotions to T
and keeps cv-qualifiers of T
,
otherwise leaves T
unchanged.
See also integral_promotion
and floating_point_promotion.
C++ Standard Reference: 4.5 except 4.5/3 (integral bit-field) and 4.6.
Compiler Compatibility: All current compilers are supported by this trait.
Header: #include
<boost/type_traits/promote.hpp>
or #include <boost/type_traits.hpp>
Table 1.26. Examples
Expression |
Result Type |
---|---|
|
|
|
|
|
|