Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

promote

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.28. Examples

Expression

Result Type

promote<short volatile>::type

int volatile

promote<float const>::type

double const

promote<short&>::type

short&



PrevUpHomeNext