Placement New
summary
Shows live code that constructs types into a raw buffer and then breaks when reusing the slot without a proper destructor call, demonstrating undefined behavior and a visible pointer aliasing bug. Compares a char array + cast approach with correct std::aligned_storage usage and shows when placement new requires std::launder to recover a pointer. Presents numbers for bytes and alignment, replaces the fragile pattern with aligned allocation and explicit destruction, and the fixed version works reliably.
AI-written summary · about
related talks
01h 02mFancy Pointers for Fun and Profit
52mNon-conforming C++: the Secrets the Committee Is Hiding From You
01h 33mSafe and Sane C++ Types
53mSmart Pointers in C++
01h 05mType Punning in C++17: Avoiding Pun-defined Behavior
55mBreaking Dependencies: Type Erasure - The Implementation Details
01h 02m“Lightweight Object Persistence With Relocatable Heaps in Modern C++"
01h 28mProgramming in Modern C with a Sneak Peek into C23
