I found some boilerplate code that at some point performs the following check:
template<class IntegralType>
void randomFunction(IntegralType t)
{
...
if (t < 0)
...
}
The idea of the code is that it thas an integer type (either signed or unsigned). The code works fine, regardless of the subscription, but the compiler generates a warning, because in the case of an integer, the unsignedcheck will always be true.
Is there a way in C ++ 03 to change the code to get rid of the warning without suppressing it? I thought about verifying the signature in tsome way, I don’t know that this is possible.
I know C ++ 11 is_signed, but I'm not sure how this can be implemented in C ++ 03.
source
share