Hi, I'm having some conceptual misunderstanding with this:
1 2 3 4 5 6
...
template <typename T> // or class T
const T MaxN(T* pt, int n);
template <>
constchar* MaxN<char*>(char** ptt, int n);
...
If I keep the const I get this error trying to compile: template-id 'MaxN<char*>' for 'const char* MaxN(char**, int)' does not match any template declaration|
If i remove the const I don't get any error. why is it? Shouldn't it be working the same with the const qualifier? I think the specialization matches perfectly the function template.
Pointer syntax is a bit inconsistent. constchar* means a pointer to a constant char. The pointer itself is not constant. For that you need to write char* const