YouTube30 Sept 2019
53m

Back to Basics: Move Semantics (part 2 of 2) - Klaus Iglberger - CppCon 2019

Podcast cover

CppCon

Klaus Iglberger delivers part two of a C++ training session on move semantics, focusing on forwarding references, perfect forwarding, and associated pitfalls. He explains how forwarding references adapt to L-values and R-values, detailing the concept of reference collapsing and its importance in perfect forwarding. The lecture explores how forwarding references solve the problem of forwarding arguments to other functions, like constructors, and introduces `std::forward` as a conditional move. Iglberger then discusses the perils of overloading with forwarding references, using examples to illustrate unexpected behaviors and offering advice to avoid common mistakes, including issues related to copy elision and incorrect usage in templates. The session concludes with a Q&A segment addressing stack frame behavior, return value optimization, and other related concerns.

Outlines

Part 1: Introduction and Perfect Forwarding

Part 2: Mechanics, Overloading, and Advice

Part 3: Common Pitfalls

Part 4: Q&A

Sign in to continue reading, translating and more.

Open full episode in Podwise