Reusable Code, Reusable Data Structures
Talkat CppCon 2024 · on Wednesday, 2024-09-18· at 15:15· Maple 3/4/5, 6700 North Gaylord Rockies Boulevard·
summary
Concrete rules for reuse: prefer small generic functions that state minimal requirements (rectangles, ranges) and use customization points like global overloads or an output function; use compile‑time patterns such as CRTP vs template base classes when code and per‑instance data must travel together; prefer intrusive containers for owned-but-polymorphic widgets and hide runtime polymorphism with the Sean Parent wrapper for extensibility; an earlier heavy polymorphic drag‑handle design is replaced by a simple draw‑time hover check and reduces needless objects and indirection.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 2:11Motivating reusable code
- 7:26Generalizing algorithms
- 10:15Generic functions in C++
- 11:38Customizing generic functions
- 17:16Sharing code and data
- 21:11Avoiding inheritance
- 23:16Runtime polymorphism trade-offs
- 25:03Polymorphic inheritance in UIs
- 28:36Intrusive containers
- 30:20External polymorphism
- 33:59When not to use polymorphism
- 36:49Dangers of std::variant
- 39:17Conclusion
related talks
23mBest Practices for reusable UI components
46mTechniques for making reusable code
35mAvoiding code spaghetti by making ravioli
57mCore Software Design Principles for Programmers
01h 11mPragmatic Simplicity - Actionable Guidelines To Tame Cpp Complexity
52mThe Code is Documentation Enough
01h 00mThe hidden rules of world-class C++ code
53mWriting Code for Humans
