【求教】结构模板化的问题,请看这个程序
#include <iostream>struct job
{
char name [40];
double salary;
int floor;
};
template <> void Swap<job>(job &j1,job &j2);
int _tmain(int argc, _TCHAR* argv[])
{
......
......
return 0;
}
template <> void Swap <job> (job &j1,job &j2)
{
double t1;
int t2;
t1 = j1.salary;
j1.salary = j2.salary;
j2.salary = t1;
t2 = j1.floor;
j1.floor = j2.floor;
j2.floor = t2;
}
请问下各位大神,这里函数原型时,用模板和不用模板 有什么具体区别呢??
template <> void Swap<job>(job &j1,job &j2);
我改成 void Swap (job &j1,job &j2);不是一样么??