~/talk

Rust Traits In C++

Talkat C++ on Sea 2025 · 2025-06-23..06-25· [c-and-cpp, software-architecture]
slides:none on file

Shows a concrete path to get Rust Traits–style runtime polymorphism in C++ by building custom virtual table structures and concrete value managers inside a type‑erasure framework (the Type Erasure / sue any family). Implements a serialize affordance with function pointers, ownership (destruct/move/copy), and value semantics, emits compact assembly in Compiler Explorer, and claims performance that matches or beats classic virtual inheritance. Uses small‑buffer optimization to avoid heap hits and demonstrates runnable code that compiles and executes.

AI-written summary · about

  1. 0:00Introduction
  2. 7:24Runtime polymorphism basics
  3. 13:23Inheritance for subtyping problems
  4. 18:44Serialization as polymorphism
  5. 22:37Rust traits for subtyping
  6. 27:11Type erasure in C++
  7. 33:09Virtual tables for dispatch
  8. 43:07UI binding in practice
  9. 45:38Live demo on Compiler Explorer
  10. 53:51C++ type erasure vs Rust traits
  11. 55:34Conclusion
~/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.