C++ Abstraction Patterns for Cross Platform Development in C++ Software Engineering
summary
Compares five concrete patterns and their tradeoffs using a two-backend example (DX12 and Vulkan). preprocessor macros produces exponential, unmergeable function bodies and is discouraged. runtime polymorphism gives a clean interface but pays vtable costs and ships all implementations in the binary. PImpl hits ODR unless the build system (CMake) includes exactly one platform source per configuration. A CRP (CRTP-derived, non-templated) pattern removes vtables and pointer indirection but is build-system dependent and hacky. C++20 modules contain platform headers and prevent leakage but struggle with separate module implementation unit visibility.
AI-written summary · about
chapters (8)
- 0:00Cross-platform abstraction intro
- 6:04Pre-processor macros
- 8:10Runtime polymorphism
- 12:31Pimpl idiom
- 17:50Build systems
- 23:28CRP without templates
- 27:24C++20 modules
- 38:43Conclusion
related talks
47mDesign Patterns - The Most Common Misconceptions (2 of N)
01h 07mDesign Patterns in Modern C++
43mDesign Patterns - The Most Common Misconceptions (1 of N)
01h 28mModern C++ Design reloaded
01h 37mC++ And Beyond: Discussion
01h 05mAbstraction Patterns: Making Code Reliably Better Without Deep Understanding
41mC++ Migration Strategies
01h 00mC++ Design Patterns: From C++03 to C++17
