~/talk

std::function: a deep dive behind the curtain

Talkat Meeting C++ 2022 · 2022-11-17..11-19· [rust]
slides:none on file

Explains how std::function stores and invokes callables: a naive implementation uses a virtual call interface and shared_ptr clone semantics, real libraries add small-buffer optimization to avoid heaps, and C++23 introduces std::move_only_function (no RTTI via target_type RTTI). Compares implementations (libstdc++, libc++, MSVC, Folly, function2), reports pointer counts varying from two up to eight-plus, shows member-pointer handling and surprising ABI quirks (MSVC has smallest member-function pointer yet a large function object), and demonstrates when allocations actually occur.

AI-written summary · about

  1. 0:00Introduction and context
  2. 1:25Function fundamentals
  3. 6:18Why use std::function
  4. 16:53Building a custom function
  5. 27:56Standards and features
  6. 40:25Benchmarking and design
  7. 54:46Move-only functions and wrap-up
  8. 1:00:47Q&A and final tricks
~/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.