Copy Elision
summary
Explains why compilers pass an address for a function result and contrasts the naive copy sequence with return value optimization by showing stack frames for caller G and callee F, where the callee writes directly into the caller’s result slot instead of copying; shows the same for copy elision where a temporary is constructed in the callee frame to avoid a copy. Notes the limitation: it fails when the caller still needs the value afterward or when an lvalue is used.
AI-written summary · about
chapters (4)
related talks
27mReturn Value Optimization: Harder Than It Looks
06mLightning Talk: Source/Sink vs. Ranges in C++ - What's the Difference?
55mBreaking Dependencies: Type Erasure - The Implementation Details
01h 27mDangerous Optimizations! in C++ - Part Deux
04mFunction Extraction with Lambda Expressions
01h 00mC++: λ Demystified
50mC++ Costless Abstractions: the compiler view
52mNon-conforming C++: the Secrets the Committee Is Hiding From You
