Code Room
Code reviewHardcr-g163
Subject Dangling pointerLevel Senior–Staff~30 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Review this C++ code using std::string_view.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewcpp
#include <string>#include <string_view> std::string make_name(int id) {    return "user-" + std::to_string(id);} void run(int id) {    std::string_view sv = make_name(id);    // ... later ...    process(sv);   // takes std::string_view}
Run or narrate your approach, then ask the coach.