// DAY_0425_0.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
template<typename T>//用在模板定义里,标明其后的模板参数是类型参数。
T Add(T t1, T t2)
{
return (t1 + t2);
}
template<typename TS>
struct AStruct
{
TS ts1;
};
int main(int argc, char* argv[])
{
cout << Add(1, 99) << endl;
cout << Add(0.5, 99.5) << endl;
return 0;
}
STL-模板
最新推荐文章于 2024-10-24 09:35:54 发布
6374

被折叠的 条评论
为什么被折叠?



