How to destructure a pair in lambda arguments

45 views Asked by At

When I use for-loop I can destructure the arguments right away, e.g.

for(const auto & [key, value] : myMap) { }

But can I do the same in lambda? (obviously not like this, this won't compile)

std::for_each(myMap.begin(), myMap.end(), [](const auto & [key, value]) { });
0

There are 0 answers