Hi stack overflow community!
I wonder why this code doesn't compile with C++17
std::unordered_map<int, int> a;
for (const auto& [k, v]: a) {
auto l = [k] () {};
}
with error "'k' in capture list does not name a variable".
But this compiles good
std::unordered_map<int, int> a;
for (const auto& [k, v]: a) {
auto l = [k = k] () {};
}
What is k in [k, v] if it is not a variable?