以下代码段将在 GCC 8+ 中编译,但无法在 GCC 7 中编译。
template <typename... THINGS>
struct A
{
explicit A(THINGS *... things)
{
(..., [thing = things](){}());
}
};
int main()
{
int thing;
const auto thingy = A{&thing};
}
声明的失败是参数包没有被扩展:parameter packs not expanded with '...'
.
检查GCC 标准合规性页面,GCC 7 应该支持折叠表达式。
我还需要另外一面旗帜std=c++17
吗?(我没有看到)
标准还没有完全实施吗?(我没有看到任何迹象)
我可以完成这项工作,或者这只是我将不得不解决的 GCC 7 错误?