Back to Basics: Forwarding References - How to Forward Parameters in Modern C++
Talkat CppCon 2023 · on Friday, 2023-10-06· at 10:30· Maple 3/4/5, 6700 North Gaylord Rockies Boulevard·
summary
Clear explanation of what a forwarding reference is, why std::forward preserves value category, and when the special deduction rule applies; shows real pitfalls: single-template constructors that hijack copy ctors and need remove_cvref<T> or constrained convertible_to checks, how to force move-only binding, and a coroutine-life-time trick (capture by value via forwarding). Concrete recommendations: prefer const T& for read-only, pass-by-value for cheap-to-move members, and constrain forwarding templates to avoid surprising overload resolution.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:27Value categories in C++
- 9:50Quiz on value categories
- 19:32C++11 rvalue references
- 26:11Forwarding references
- 33:58Perfect forwarding with std::forward
- 36:03Pitfalls with forwarding
- 43:05Copy constructor hijacking
- 47:02Restricting to rvalues
- 50:19Coroutines and arguments
- 52:50Returning parameters
- 55:22auto&& in generics
- 57:09Best practices
- 1:01:05Q&A








