xieite ::try_sign <>
Defined in header <xieite/meta/try_sign.hpp>
If a type is an unsigned integer, evaluates to its signed counterpart.
Otherwise, leaves the type unchanged.
Declaration
template <typename T >using try_sign =std ::conditional_t <xieite ::is_unsigned <T >,std ::make_signed <T >,std ::type_identity <T >>::type ;
Example
Output:int main () {xieite ::dump (std ::same_as <int ,xieite ::try_sign <unsigned int >>);xieite ::dump (std ::same_as <double ,xieite ::try_sign <double >>); }
[View in Compiler Explorer]true true