Let's Move
summary
Implements a small email class, fills a vector with 100000 addresses and measures: initialization ~220 ms, sort ~4–5 s. Shows concrete optimizations: take string by value and move halves init time; return const reference for lvalues and value for rvalues (overload getter for &&) speeds sort ~10×; remove_if reveals moved‑from invariants, so code adds move ctor/assign that restore a valid state. Adding noexcept on moves drops realloc cost (about 250→200 ms). Demonstrates forwarding/universal references and compiler differences (gcc, MSVC).
AI-written summary · about
chapters (9)
- 0:00Start
- 1:57Check State
- 2:36Output Operator
- 10:33Sort Function
- 17:55Implementation for Temporary Objects
- 24:33Move Semantics
- 40:43Print Statements
- 47:26Universal Reference
- 48:17Forwarding References
related talks
01h 04mBack to Basics: Move Semantics
01h 06mThe Hidden Secrets of Move Semantics
01h 02mBack to Basics: Almost Always Vector
01h 02mBack to Basics: C++ Move Semantics
06mLightning Talk: Writing a Better std::move
56mC++ Relocation - How to Achieve Blazing Fast Save and Restore and More!
01h 00mIntroduction to Hardware Efficiency in Cpp
08mOn "simple" Optimizations
