【发布时间】:2021-05-28 11:59:02
【问题描述】:
这可能是一个简单的问题,但我似乎无法弄清楚为嵌套类模板定义类型别名的语法。
基本上,我有:
template<class T>
struct Outer {
template<class U = T>
struct Inner {};
}
我希望能够从类定义外部访问 Inner 类作为类型。 我试过了:
template<class T>
using Inner = typename Outer<T>::Inner;
或
template<class T, class U = T>
using Inner = typename Outer<T>::Inner<U>;
但这没有用。
这实际上应该怎么做?
【问题讨论】:
标签: c++ inner-classes type-alias