class关键字的同义词
1
2
3
4
5
6
|
// 定义一个返回参数中较大者的通用函数
template
<
typename
T>
const
T& max(
const
T& x,
const
T& y)
{
return
x > y ? x : y;
}
|
1
2
3
4
5
6
|
// 定义一个返回参数中较大者的通用函数
template
<
class
T>
const
T& max(
const
T& x,
const
T& y)
{
return
x > y ? x : y;
}
|
以上两段代码没有功能上的区别。
第二点 很重要!!! 模板中标明“内嵌依赖类型名”
http://dev.yesky.com/13/2221013.shtml