Code AnalysisHard 60s
Lifetime extension of returned-by-value ref
What is the state of r here?
Starter code
class C {
public:
std::string get() const { return first; }
private:
std::string first;
};
const std::string &r = C().get();
std::cout << r;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.