函数模板

语法

template 
//使用class 替换typename 也可以
void Swap (anytype  &a, anytype &b)
{
    Anytype temp;
    temp =a ;
    a=b;
    b=temp;
}

函数声明与定义时都要有 template

你可能感兴趣的:(函数模板)