Computes a type that can represent all values in a list of types. More...
#include <eve/traits/common_type.hpp>
Required header: #include <eve/traits/common_type.hpp>
Similar to std::common_type
.
We cannot use std::common_type
because it tends to return a bigger type: For example: std::int16_t
, std::int8_t
will return std::int32_t
: https://godbolt.org/z/vjf9c45E5
We also do not follow standard promotion rules: std::common_type_t<std::int16_t, std::uint16_t>
is std::int32_t
BUT: std::common_type_t<std::int32_t, std::uint32_t>
is std::uint32_t
We always do like 32 bit one: - eve::common_type_t<std::int16_t, std::uint16_t>
is std::uint16_t
For functors from eve/constant support is incomplete: FIX-#941. For now, we just skip them.
NOTE: for signed unsigned of the same size we return unsigned of this size (same as std).
For product types TODO: FIX-#905 Right now we have some simplified logic.