template <class T>
void Swap(T &,T &);
template <> void Swap<int>(int &,int &);
template <> void Swap<char>(char &,char &);
template <> void Swap<job>(job &,job &); //可以个性化定制本函数内容
int main()
{
int a,b;
char c,d;
job e,f;
Swap(a,b);
Swap(c,d);
Swap(e,f);
}
2017.06.07 c++模板的学习
最新推荐文章于 2023-11-21 17:25:49 发布