Meta-function to define an integral type with size than is (roughly) twice the bit size of T. More...
#include <promote_integral.hpp>
Public Types | |
using | type = typename detail::promote_integral::promote_to_larger< T, integral_types, min_bit_size_type::value >::type |
Meta-function to define an integral type with size than is (roughly) twice the bit size of T.
This meta-function tries to promote the fundamental integral type T to a another integral type with size (roughly) twice the bit size of T.
To do this, two times the bit size of T is tested against the bit sizes of: short, int, long, boost::long_long_type, boost::int128_t and the one that first matches is chosen.
For unsigned types the bit size of T is tested against the bit sizes of the types above, if T is promoted to a signed type, or the bit sizes of unsigned short, unsigned int, unsigned long, std::size_t, boost::ulong_long_type, boost::uint128_t if T is promoted to an unsigned type.
By default an unsigned type is promoted to a signed type. This behavior is controlled by the PromoteUnsignedToUnsigned boolean template parameter, whose default value is "false". To promote an unsigned type to an unsigned type set the value of this template parameter to "true".
Finally, if the passed type is either a floating-point type or a user-defined type it is returned as is.