~/talk

How to "OO" in C++

Talkat CppNorth 2022 · 2022-07-18..07-20· [c-and-cpp, software-architecture]
links:none on file
slides:none on file

Compares four concrete approaches to polymorphism in C++—inheritance with virtuals, templates/concepts, std::variant with std::visit, and the visitor/overloaded patterns—shows a microbenchmark where removing virtual saves over 10x faster in a specific loop by enabling optimization, demonstrates mutex/lock_guard implemented with templates (no virtuals) to avoid heap and runtime dispatch, and weighs tradeoffs: runtime dispatch flexibility vs compiler optimizability, fixed object layout and verifiability costs of virtuals, and the need to recompile when adding types with std::variant + std::visit while recommending concept-based dispatch for many cases.

AI-written summary · about

  1. 0:00Introduction to OO in C++
  2. 1:25What is object orientation
  3. 5:43Virtual vs non-virtual methods
  4. 8:27Performance cost of virtual methods
  5. 13:48Compiler optimization limits
  6. 15:57Interoperability and verifiability issues
  7. 16:47SOLID principles and inheritance
  8. 17:57Client-side extensibility problem
  9. 20:04Alternatives to virtual methods
  10. 21:11Mutex design without virtuals
  11. 25:23Concept-based approach
  12. 33:48Choosing between concepts and inheritance
  13. 34:12Visitor pattern for extensibility
  14. 38:34Duck typing and variants
  15. 42:11Using std::variant for polymorphism
  16. 46:50Overloaded pattern for runtime dispatch
  17. 49:19Best practices for polymorphism
  18. 50:56Modern C++ alternatives to static polymorphism
  19. 51:41Type erasure as a tool
  20. 52:05Q&A on C++ standards and optimizations
~/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.