~/talk

Modern C++ Development: Limitations and Problems in std::function and Similar Constructs

Talkat CppCon 2024 · on Sunday, 2024-09-15· [developer-experience]
links:none on file
slides:none on file

Claims that std::function, std::packaged_task and std::apply cause unexpected copies and moves and demonstrates them with an instrumented class that logs every copy/move. Measured counts show surprising churn (e.g. three moves for captured objects, two moves for by-value parameters, extra copies on bind and on some toolchains). Builds a concrete mitigation: a tuple-based holder plus a move wrapper and a templated function_holder that collapses copies to zero, cuts moves to the theoretical minimum and reduces heap allocations to one, with caveats about safety of the move wrapper.

AI-written summary · about

  1. 0:00Welcome
  2. 1:50Adobe's cross-platform C++
  3. 5:24Lambdas and captures
  4. 10:39std::function overhead
  5. 16:24Unnecessary copies in std::function
  6. 24:31Optimal moves and copies
  7. 29:11std::function and shared_ptr
  8. 34:56Move wrapper to avoid shared_ptr
  9. 38:49Tuples for function parameters
  10. 48:01Conditional move and tuple logic
  11. 52:19Reducing boilerplate with traits
  12. 56:41Function holder solution
  13. 1:00:24Q&A
~/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.