All challenges
Code AnalysisBeginner 60s

Range-for over a temporary container

What is the problem with this code?
Starter code
#include <string>
#include <vector>

std::vector<std::string> make();

void f() {
    for (std::string_view s : make()) {
        // use s
    }
}

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.

Play this in a 3-minute battle