(资料图)
void test01() { int a = 10; int b = 20; mySwap(a,b); // 2 编译器在函数模版被调用时,进行第二次编译。会把泛型T替换成具体的类型 /* void mySwap(int &a, int &b){ int tmp = a; a = b; b = tmp; } */ cout << "a = " << a << endl; cout << "b = " << b << endl;
Copyright @ 2015-2023 今日家电网版权所有 备案号: 沪ICP备2023005074号-40 联系邮箱:5 85 59 73 @qq.com