Skip to content
UPEEC

Object Lifetime

When an object begins and ends — and rules about using it outside that window.

Advanced
Comments 0

Dangling references to temporaries are a classic bug: const std::string& s = get_name().substr(1); is fine (lifetime extended), but returning a reference to a local isn't.

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.