~/talk

To Move or Not to Move - An Interactive Analysis

Talkat CppNorth 2023 · 2023-07-17..07-19· [c-and-cpp]
slides:none on file

Interactive code-driven analysis of when std::move helps or hurts, using small examples (custom traceable string, stack push/pop, max function, lambda capturing unique_ptr) and tooling demos (sanitizers, Compiler Explorer + clang-tidy). Shows std::move is a cast to rvalue, don't std::move local return values (NRVO/implicit move is cheaper), proves moving a const yields a copy, proves moving after pop_back yields undefined behavior, and explains why move constructors should be noexcept for vector reallocation safety.

AI-written summary · about

  1. 0:00Introduction and speaker background
  2. 1:56Why we need move semantics
  3. 4:05Move semantics basics in C++11
  4. 6:34When to use std::move
  5. 12:17Dangers of moving L values
  6. 15:53Passing by value and move semantics
  7. 23:14Returning local variables
  8. 29:56Rvalue references vs forwarding references
  9. 37:23Implementing stack push and pop
  10. 44:17Dangling references after pop
  11. 47:50noexcept in move operations
  12. 50:20Rule of zero and move semantics
  13. 51:46Avoid moving the same resource twice
  14. 55:16Moving unique_ptr into a lambda
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.