Template-id does not match any template declaration
Hi, I'm having some conceptual misunderstanding with this:
template <typename T> // or class T
const T MaxN(T* pt, int n);
const char* 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.
const char* means a pointer to a constant char. The pointer itself is not constant. For that you need to write
char* const MaxN<char*>(char** ptt, int n);
Arg, I get the point. So it's true it really doesn't match the template.
Topic archived. No new replies allowed.