All challenges
Multiple ChoiceHard 45s

string_view as function parameter

A function takes `std::string_view` and stores it in a member that outlives the call. The risk is:
Options
  1. 1None; a string_view always owns its own buffer, so storing it never risks a dangling view.
  2. 2If the caller passed a temporary std::string, the view dangles; string_view never owns or keeps lifetime.
  3. 3It is safe, because string_view deep-copies the source string during its construction.
  4. 4It is safe, because string_view keeps the source alive through shared ownership counting.

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