What problem does it solve?
This Skill helps C++ developers decide between static and dynamic polymorphism to minimize runtime overhead, avoid object slicing and template/linker pitfalls, and balance binary size versus flexibility.
Core Features & Use Cases
- Static dispatch guidance: When to use templates, Concepts, and CRTP for zero runtime cost and maximal optimization.
- Dynamic dispatch guidance: When to use virtual functions, std::variant, std::function, or type-erasure for runtime flexibility and plugin-style extensibility.
- Practical scenarios: Use templates or std::variant for closed sets and high-performance code, prefer virtual interfaces for runtime-extensible APIs and plugin systems, and apply Concepts to constrain templates and prevent template spew and misuse.
Quick Start
Prefer templates or CRTP for static dispatch when types are known at compile time, and switch to virtual functions or heap-polymorphism when runtime extensibility or heterogeneous containers are required.