说我有这个设置:
template<typename T1>
struct A {
template<typename T2>
struct B {
using type = int;
};
};
我想能够形成一个typedef /使用:
template<typename T1,typename T2>
using type2 = A<T1>::B<T2>::type;
//... and use like
type2<int,char> foo;
GCC complains that I need typename A<T1>::B<T2>::type
instead, and afterwards complains that it expects ";" before "<" after B (i.e. typename A<T1>::B
)
没有办法对嵌套模板使用“使用”?
Note that
B
is a templated class andtype
is enclosed in a templated class, hence use the following从切换
至