~/talk

Breaking Dependencies - C++ Type Erasure - The Implementation Details

Talkat CppCon 2022 · 2022-09-11..09-16· [rust]
slides:none on file

Shows two ~20 line implementations for owning and non-owning wrappers, then builds a real shape wrapper with a templated constructor, clone-based copy, and an optional Small Buffer Optimization (128 bytes) to avoid allocations. Benchmarks use 10,000 randomly chosen shapes and 25,000 cheap translate ops, finding about a 10% win with SBO. Also demonstrates manual virtual dispatch (≈10 lines) as an alternative to vtables and explains move/copy semantics, storage-policy tradeoffs, and when each technique actually improves performance.

AI-written summary · about

  1. 0:00Introduction
  2. 1:42Motivation
  3. 5:02Implementation
  4. 11:52Implementation Details
  5. 15:22Shape Wrapper
  6. 17:09Friends
  7. 19:31Clone
  8. 20:25Copy
  9. 25:37No pointers
  10. 26:46Architectural Boundaries
  11. 28:57Test Code
  12. 29:28Extended Model
  13. 32:43Performance
  14. 33:27Explanation
  15. 35:11Performance Optimization
  16. 36:05Small Buffer
  17. 39:39Clone Function
  18. 42:03destructor
  19. 42:37copyswap
  20. 44:05template parameters
  21. 46:19too deep
  22. 46:42simple
  23. 48:11manual virtual dispatch
  24. 50:36code
  25. 55:03benchmark
  26. 56:07conclusion
  27. 57:54Questions
~/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.