Code AnalysisHard 60s
Lambda in loop capturing by reference
What is printed?
Starter code
std::vector<std::function<void()>> fs;
for (int i = 0; i < 3; ++i)
fs.push_back([&] { std::cout << i; });
for (auto &f : fs)
f();Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.