标签:
再看一本叫做<STL Lectures>的书,里面有一段代码让我学习了</pre><pre name="code" class="cpp">#include<iostream>
#include<string>
using namespace std;
template <typename T>
const T& max(const T& x, const T& y)
{
if( y < x )
return x;
return y;
}
int main()
{
cout << max(3,7) << endl;
cout << max(3.0,4.0) << endl;
cout << max<double>(3,8.0) << endl;
cout << max<char>('A','C');
return 0;
}
标签:
原文地址:http://blog.csdn.net/u013163178/article/details/42582459