摘要:
primer Plus在解释具体化和实例化看的有点乱,分解出来备忘在代码中包含函数模板本身并不会生成函数定义,它只是用于生成函数定义的方案编译器使用模板为我写类型生成函数定义时,得到的是模板实例如这个模板templatevoid Swap(T &t1,T &t2){ T _t; _t=t1; t1=t2; t2=_t;}调用 int i = 10,j=20; ::cout指示类型并在声明前加上template:template void Swap(int &t1,int &t2);例子#includeusing namespace std;templ... 阅读全文
posted @ 2013-12-18 12:31
li-peng
阅读(5406)
评论(1)
推荐(0)

浙公网安备 33010602011771号