~/talk

“The Nightmare of Move Semantics for Trivial Classes”

Talkat CppCon 2017 · 2017-09-24..09-29· [c-and-cpp, software-architecture]
links:none on file
slides:none on file

Examines a simple Customer class with three members and counts actual string allocations for various constructor designs: naive const-ref approach produces up to four mallocs for two literals, exhaustive overloads yield the optimal five mallocs for common cases, pass-by-value plus std::move cuts overloads and gets near-optimal behavior, and a single-template forwarding-ref solution uses perfect forwarding but requires enable_if SFINAE gymnastics to avoid hijacking copy construction and derived types; recommends pass-by-value+move as the pragmatic winner.

AI-written summary · about

  1. 0:00Introduction
  2. 1:04Problem Statement
  3. 4:06Overload
  4. 6:13Move Semantics
  5. 13:05Passing by Value
  6. 17:07Universal Reference
  7. 17:41Forwarding Reference
  8. 18:45Perfect Following
  9. 20:15No viable conversion
  10. 24:13Copy constructor
  11. 27:47Enable if
  12. 31:24Error
  13. 32:57Ampersand
  14. 34:17VIP Customers
  15. 41:37C20 requires
  16. 43:07No further trap
  17. 43:57Pass strings by value
  18. 51:02Discussion
~/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.