版本比较
C++泛型编程&STL
正文
增加 11 行删除 11 行
49 行未改动50515253545556575859606 行未改动67686970717273747572 行未改动14814915015115215315415515664 行未改动22122222322422522622722822985 行未改动31531631731831932032132232358 行未改动38238338438538638738838939063 行未改动4544554564574584594604614625 行未改动4684694704714724734744754769 行未改动486487488489490491492493494108 行未改动全部展开6036046056066076086096106117,772 行未改动全部展开49 行未改动**语法:**```C++template<typename T>函数声明或定义```**解释:**6 行未改动**示例:**```C++//交换整型函数void swapInt(int& a, int& b) {int temp = a;72 行未改动**示例:**```C++//利用模板提供通用的交换函数template<class T>void mySwap(T& a, T& b){64 行未改动示例:```C++//交换的函数模板template<typename T>void mySwap(T &a, T&b){85 行未改动**示例:**```C++//普通函数int myAdd01(int a, int b){return a + b;58 行未改动**示例:**```C++//普通函数与函数模板调用规则void myPrint(int a, int b){cout << "调用的普通函数" << endl;63 行未改动**例如:**```C++template<class T>void f(T a, T b){a = b;5 行未改动再例如:```C++template<class T>void f(T a, T b){if(a > b) { ... }9 行未改动**示例:**```C++#include<iostream>using namespace std;#include <string>108 行未改动全部展开**语法:**```c++template<typename T>类```7,772 行未改动全部展开49 行未改动50515253545556575859606 行未改动67686970717273747572 行未改动14814915015115215315415515664 行未改动22122222322422522622722822985 行未改动31531631731831932032132232358 行未改动38238338438538638738838939063 行未改动4544554564574584594604614625 行未改动4684694704714724734744754769 行未改动486487488489490491492493494108 行未改动全部展开6036046056066076086096106117,772 行未改动全部展开49 行未改动**语法:**```Cpptemplate<typename T>//函数声明或定义```**解释:**6 行未改动**示例:**```Cpp//交换整型函数void swapInt(int& a, int& b) {int temp = a;72 行未改动**示例:**```Cpp//利用模板提供通用的交换函数template<class T>void mySwap(T& a, T& b){64 行未改动示例:```Cpp//交换的函数模板template<typename T>void mySwap(T &a, T&b){85 行未改动**示例:**```Cpp//普通函数int myAdd01(int a, int b){return a + b;58 行未改动**示例:**```Cpp//普通函数与函数模板调用规则void myPrint(int a, int b){cout << "调用的普通函数" << endl;63 行未改动**例如:**```Cpptemplate<class T>void f(T a, T b){a = b;5 行未改动再例如:```Cpptemplate<class T>void f(T a, T b){if(a > b) { ... }9 行未改动**示例:**```Cpp#include<iostream>using namespace std;#include <string>108 行未改动全部展开**语法:**```cpptemplate<typename T>类```7,772 行未改动全部展开