m04-zero-cost

Community

Zero-cost C++ polymorphism for high performance

Author13eholder
Version1.0.0
Installs0

System Documentation

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.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: m04-zero-cost
Download link: https://github.com/13eholder/Modern-Cpp-Skills/archive/main.zip#m04-zero-cost

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.