【发布时间】:2012-02-10 14:51:41
【问题描述】:
template < int ...Indices>
class T1 {
template <int _1, int _2>
class T2;
};
template <int ...Indices>
template <int _1>
class T1<Indices...>::T2<_1, sizeof...(Indices)> {};
//^--error: non-type template argument depends on a template parameter of the partial specialization
在 gcc 4.5+ 上编译,但在 clang 3.1 和 icc 上都没有编译,两者都抱怨sizeof...(Indices) 的使用。
它只是后者编译器中尚未实现的功能还是某些特殊情况?
谢谢,
布特
【问题讨论】:
-
看起来像那些编译器中的错误。如果可以,请尝试在
T1的class {}块内定义嵌套模板,如有必要,可能会委托给单独的成员模板。
标签: c++ c++11 template-specialization nested-class variadic-templates