~/talk

Back to Basics: Move Semantics (part 1 of 2)

Talkat CppCon 2019 · 2019-09-15..09-20· [c-and-cpp]
slides:none on file

Explains why and how to implement move semantics: rvalue references and std::move are the mechanism, std::forward for perfect forwarding, and move ctor/assign must do memberwise moves plus explicit handling of owning raw pointers (or prefer unique_ptr so phase two disappears). Covers rule of zero/five, when the compiler generates special members, using std::exchange, swap-vs-explicit implementation tradeoffs, self-move behavior, and shows that default move does memberwise moves and that std::move yields an rvalue reference and noexcept on move yields large speedups (measured ~60% in his vector example).

AI-written summary · about

  1. 0:00Introduction
  2. 2:22Real basics
  3. 8:00Technical terms
  4. 20:08Move constructor
  5. 26:46Move operations no except
  6. 33:43Move assignment operator
  7. 49:27Special member functions
  8. 50:12When does the compiler generate these functions
  9. 52:24The Rule of Five
  10. 53:27References
~/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.