对于模板函数compare(如下)
- template<typename T>
- int compare(const T&v1,const T&v2)
- {
- if(v1<v2)
- return -1;
- if(v2<v1)
- return 1;
- return 0;
- }
when invoking compare("hi","world"),you'll encounter a compile error. The explain in c++ primer is in section 16.6(page 671).
The invoke is the same as compare(cosnt char*,const char*).