我正在尝试使用折叠表达式来简化一些代码。在下面的代码中,我试图将元素插入到数组中,但折叠表达式无法编译
struct test {
std::string cmd[20];
test() {
int i = 0;
auto insert = [&](auto... c) {
assert(i < 20);
(cmd[i++] = c), ...;
};
insert("c");
insert("c", "c2");
}
};
编译器提示缺少';'
最佳答案
关于c++ - 在赋值中折叠表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54955868/