有什么(有用的?)区别:
auto test = [..](..){..};
和
const auto test = [..](..){..};
?
最佳答案
是的,如果 lambda 被声明为 mutable
,那么您不能在第二种情况下调用它。
int x = 0;
const auto test = [x]() mutable { ++x; };
test(); // error
关于c++ - lambda 的 const auto 和 auto 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32040385/