m04-zero-cost
Installation
SKILL.md
C++ Zero-Cost Abstractions
Core Question
When do we determine the type?
- Compile Time (Static): Templates, Concepts, CRTP. Zero runtime cost, larger binary.
- Runtime (Dynamic): Virtual functions,
std::any,std::variant. Flexible, vtable overhead.
Error → Design Question
| Issue | Design Question |
|---|---|
| Template spew | Are you missing Concepts constraints? |
| Linker error | Did you define template in .cpp instead of .h? |
| Object slicing | Did you assign Derived to Base value? |
| Slow build | Are you overusing headers/templates? |