编辑代码

#include <iostream>
#include <string>

using std::endl;
using std::cout;
using std::cin;

/*函数模板入门*/
// template<typename T> void swapname(T& a,T& b)
// {
//     T c;
//     c=a;
//     a=b;
//     b=c;
// }



/*函数模板声明定义分开*/
// template<class T> void get_size(T a);

int main() {
    /*函数模板入门*/
    // std::string a="Hello";
    // std::string b="World";
    // swapname(a,b);
    // cout<<"a: "<<a<<endl;
    // cout<<"b: "<<b<<endl;

    /*函数模板定义分开*/
    // std::string a="Hello";
    // get_size(a);

    return 0;
}
/*函数模板定义分开*/
// template<class T>
// void get_size(T a){
//     cout<<"Type size is "<<sizeof(T)<<endl;
// }