template <typename T>
bool validate(const T& minimum, const T& maximum, const T& testValue) {
return testValue >= minimum && testValue <= maximum;
}
template <>
bool validate<const char&>(
const char& minimum,
const char& maximum,
const char& testValue)
{
char a = toupper(testValue);
char b = toupper(minimum);
char c = toupper(maximum);
return a >= b && a <= c;
}
This is the function template, somehow in main
when validate
function is called, it never uses the second function(the one for const char&
) even when the parameters are char
. Can anyone see where my problem is?