一个简单的例子:
template<typename _X> // this template parameter should be usable outside!
struct Small {
typedef _X X; // this is tedious!
X foo;
};
template<typename SomeSmall>
struct Big {
typedef typename SomeSmall::X X; // want to use X here!
SomeSmall bar;
X toe;
};
Run Code Online (Sandbox Code Playgroud)
有没有办法在不使用类中的typedef X的Small情况下访问模板参数Small?