I have a template function which takes an integer type, such as:
template<class IntType>
IntType foo(IntType value)
{
IntType ret;
// As I may need to do 64bit operations,
// so I would like the return type same as the input type
......;
return ret;
}
In the function I need to do bitwise shift operations on value. As right shift is different between signed and unsigned integers, so I need to convert between signed and unsigned types. It seems I cannot use either std::is_unsigned and std::make_unsigned, could anyone please tell me how can I make a template type to unsigned? Thank you!
Aucun commentaire:
Enregistrer un commentaire