int main()
{
A<B<A> > a;
// --> A is a template (suppose with type-tempalte-argument)
// --> type-agument is B<A>
// --> B is a template with template-template-arugment A!!!
}
1:在第一种包含情形下:
B -->(includes) A
将导致这个函数不能使用:
template <typename T>
void foo(A<T>&);
2:在继承情况下:
A<B>
|
|
B
template <typename T>
void foo(A<T>&);
这个接口函数是可以使用的:
B b;
foo(b);
这个函数模板参数的推导用了STD98中关于《函数调用情形下模板参数推导》
例外情况下的最后一种:
"if P is a template-id ( 这里是A<T>),
A could be derived class of P."