2013年1月17日
摘要: #include <iostream>using namespace std;typedef void(*FUNC)(void);void a(){ cout << "This is a func ! \n";}void b(){ cout << "This is b func ! \n";}class c{public: void operator()(void) { cout << "This is a class c!\n"; }};template<class T>c 阅读全文
posted @ 2013-01-17 17:31 xunya 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1 #include <iostream> 2 3 using namespace std; 4 5 template <typename T> 6 void AnySwap(T &a, T &b) 7 { 8 T temp = a; 9 a = b;10 b = temp;11 }12 //重载13 template <typename T>14 void AnySwap(T a[], T b[], int n)15 {16 T temp;17 for(int i = 0; i < n; i++)18 {19 temp = a[i]; 阅读全文
posted @ 2013-01-17 12:02 xunya 阅读(142) 评论(0) 推荐(0) 编辑