I have found some templated code which at some point performs the following check:
template<class IntegralType>
void randomFunction(IntegralType t)
{
...
if (t < 0)
...
}
The idea of the code is that t
is of an integral type (either signed or unsigned). The code works just fine regardless of signedness, but the compiler issues a warning because in the case of an unsigned
integer the check will always be true.
Is there a way in C++03 of modifying the code to get rid of the warning without suppressing it? I was thinking of checking the signedness of T
somehow, don't know it it's possible.
I am aware of C++11's is_signed
but I am not sure how it could be implemented in C++03.