Templated Functions.. ERROR: template-id does not match any template declaration

I have written a function template and an explicitly specialized templated function which simply takes in 3 arguments and calculates the biggest among them and prints it.

The specialized function is causing an error,whereas the template works fine. Но я хочу работать с char * type .

Это ошибка, которую я получаю => error: template-id ‘Max<>’ for ‘void Max(char, char, char)’ does not match any template declaration

Following is my code:

    template <typename T>
    void Max(T& a,T& b,T& c)
    {
            if(a > b && a >> c)
            {
                    cout << "Max: " << a << endl;
            }
            else if(b > c && b > a)
            {
                    cout << "Max: " << b << endl;
            }
            else
            {
                    cout << "Max: " << c << endl;
            }
    }

    template <>
    void Max(char* a,char* b,char* c)
    {
            if(strcmp(a,b) > 0 )
            {
                    cout << "Max: " << a << endl;
            }
            else if(strcmp(b,c) > 0)
            {
                    cout << "Max: " << b << endl;
            }
            else
            {
                    cout << "Max: " << b << endl;
            }
}
5
задан Pavitar 14 October 2010 в 19:30
поделиться