这是解决 GCC "sorry, unimplemented: cannot expand ‘NEXT ...’ into a fixed-length argument list"错误的好方法吗?
Is ther a good workaround for GCC's "sorry, unimplemented: cannot expand ‘NEXT ...’ into a fixed-length argument list" error?
可能重复:
可变模板的GCC错误:“抱歉,未实现:无法扩展';标识符…#39;进入固定长度的参数列表";
我有这个代码,它会产生标题中显示的错误消息:
#include <iostream>
template <int FIRST, int... NEXT>
struct Test {
static const int VALUE = FIRST + Test<NEXT...>::VALUE;
};
template <int FIRST>
struct Test<FIRST> {
static const int VALUE = FIRST;
};
int main() {
std::cout << Test<1, 2, 3>::VALUE << std::endl; // print "6"
return 0;
}
有没有什么简单的变通方法可以让它在GCC中编译而不改变它的功能?
更新GCC。
相关文章:
- 使用std::multimap迭代器创建std::list
- 表示"accepting anything for this template argument" C++概念的通配符
- 来自 std::list 的迭代器 .end() 按预期返回"0xcdcdcdcdcdcdcdcd"但 .begin()
- 如何在 C 中正确使用 libiconv 使其不会报告"Arg list too long"?
- C++中带有List类的迭代器Segfault
- 使用"std::unordereded_map"映射到"std::list"对象
- GCC对可能有效的代码抛出init list生存期警告
- 如何修复错误消息,如"argument list for class template is missing"?
- 矩阵类:"No instance of overloaded function push_back matches the argument list"
- C++ "argument list for class template "迭代器" is missing"错误
- 方法定义中的错误"passing const List<int> as this argument discards qualifiers"
- "Function call missing argument list" ?
- 需要帮助理解 GCC 给出"within a nested template argument list"错误的含义
- 这是解决 GCC "sorry, unimplemented: cannot expand ‘NEXT ...’ into a fixed-length argument list"错误的好方法吗?
- "more than one instance of overloaded function " 标准::p ow " matches the argument list"
- MSVC:"use of class template requires template argument list" STL 容器内
- "use of class template requires template argument list"错误,即使使用了模板的模板,因此模板类是预期的
- 模板中的模板:为什么"`>>' should be `> >' within a nested template argument list"
- "use of class template requires template argument list"是什么意思?
- 错误"function call missing argument list" - 帮助为我指明正确的方向