Function Templates
Function templates let you write one function that works with different types. The compiler generates specific versions for each type you use.
Class Templates
Class templates create generic classes that work with different types. Think std::unique_ptr - same class, different types.
Argument Deduction
Template argument deduction lets the compiler figure out template parameters from function arguments automatically. No need to write func(5) when func(5) works!
Fold Expressions
Fold expressions provide a concise way to apply operators to variadic template parameter packs. They eliminate the need for recursive template patterns.
Specialization
2 items
Variadic Templates
Variadic templates accept any number of arguments of any types. They're the foundation for functions like std::make_tuple, printf, and perfect forwarding.
Type Traits
Type traits are compile-time tools that query and transform types. They power template metaprogramming and SFINAE, letting you write code that adapts to different types automatically.
SFINAE & enable_if
SFINAE (Substitution Failure Is Not An Error) is a fundamental C++ template mechanism that enables conditional template compilation. std::enable_if is the primary tool for applying SFINAE in practice.
Concepts & Requires
Concepts are named requirements for template arguments that replace SFINAE and enable_if with readable constraints. Requires expressions are the building blocks that check if code compiles at compile-time.