- 模板类型参数可以自动进行多层传递
- 在类中声明普通类类型是,使用typedef
- 类中声明其他类中定义的类类型时,使用 typedef typename
template
class first{
public:
typedef int st;
};
template
class second{
public:
typedef first::st s; //报错
typedef typename first::st s; //正确
};
template
class third
{
public:
typedef second f; //正确
typedef typename second :: s ts; //正确,
//T传递给second和first }