An (In-) Complete Guide to C++ Object Lifetimes
summary
Deep dive into when lifetimes actually start and end: exact rules for temporaries and temporary lifetime extension, placement new plus explicit destruction and std::destroy_at, when malloc/mmap/operator new create no objects and how implicit object creation or manual std::start_lifetime_as fixes that, provenance and strict‑aliasing impacts on optimizations, when std::launder or std::bit_cast are required, union common initial sequence, and which patterns compilers accept or optimize away.
AI-written summary · about
chapters (10)
- 0:00Welcome
- 6:30Object fundamentals
- 11:48Storage duration basics
- 18:50Temporary objects
- 29:20Placement new
- 36:58Implicit object creation
- 44:05Provenance rules
- 51:54Type punning
- 54:02Dangling references
- 59:19Q&A
related talks
35mAn (In-)Complete Guide To C++ Object Lifetimes
01h 01mC++ Object Lifetime: From Start to Finish
58mTaking a Byte Out of C++ - Avoiding Punning by Starting Lifetimes
01h 03mLifetime Safety in C++: Past, Present and Future
58mUnderstanding and Mastering C++'s Complexity
35muse <'lifetimes> for <'what>
01h 10mAn Overview of C++11/14, Part II
49mBack to Basics: C++ Smart Pointers
