|
-
July 3rd, 2010, 03:44 AM
#5
Re: Help with Specialization error
 Originally Posted by superbonzo
It's not a "best match" because it's not even a legal definition. The signature of a function template specialization must match the signature of the to be specialized function template.
So you can write
Code:
template <> char* maxn<char>(char* str[], int ct); // illegal, it's a potential specialization of a function template with signature template <class T> T* maxn(T* str[],int);
template <> char* maxn<char*>(char* str[], int ct); // ok, it's a specialization of a function template with signature template <class T> T maxn(T str[],int);
template <> char* maxn(char* str[], int ct); // ok, as above; but this time the type is deduced
char* maxn(char* str[], int ct); // ok, a function overload
Oh, thanks for the clarification, but I think using the first form is the best? because type deduction isn't standard C++ as far as I know, thank you very much for you help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|