Applied Modern C++: beyond type erasure and visitor pattern
summary
Claim: a reusable C++ library composes type erasure and visitor pattern via templated base, pimple (pimpl) strategies and a visitor strategy so a pipeline can grow both types and operations. Tools: templates, std::function/func pointers, optional manual dispatch vtable via function pointers, and comparison to std::variant. Built: demo (animals, OpenGL drawer), code on GitHub, measurements show classic type eraser ~10–20% slower than std::variant while manual dispatch is roughly on par, and the implementation works and is ready for production use.
AI-written summary · about
chapters (22)
- 0:00Introduction to talk
- 1:10Agenda and goals
- 2:41Software evolution
- 3:40Architectural flexibility
- 5:04Pattern summary
- 6:02Visitor pattern with std::visit
- 7:19Visitor pattern examples
- 8:31Visitor pattern pros and cons
- 10:12Type erasure pattern
- 10:43Type erasure implementation
- 11:52Type erasure pros and cons
- 12:57The problem of flexibility
- 14:47Proposed solution
- 16:01Solution implementation
- 24:22Hybrid pattern dependency graph
- 26:36Performance measurement
- 28:25Code demo
- 30:53Adding new types and actions
- 37:00Alternative implementations
- 37:31Handling errors
- 38:56Lessons learned
- 41:10Q&A
related talks
01h 02mBreaking Dependencies - The Visitor Design Pattern in Cpp
49mEnough TMP to write a Variant
06mLightning Talk: Cute Approach for Polymorphism in C++
01h 05mThe Imperatives Must Go!
58mApplied Modern C++: The problem of messages versioning in API
41mEnough TMP to write a Variant
01h 07mDependency Injection Patterns: Efficiency and Usability
25mType driven user interfaces with Qt and C++
