I have the following code:
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)
{
// Allows comparisons with char arguments, ignoring case
// Localize by calling previously defined function
return validate(toupper(minimum), toupper(maximum), toupper(testValue));
}
The first template is used for any inputted types, and the specialization is for literal characters. The code compiles and runs with a main.cpp to test it, but after testing, I found that the specialization isn't being called. It calls the main template. I can't figure out why.