Part 5
Generic programming
Writing code once that works for every type it makes sense for, with errors that name the real problem.
-
5.1
Function templates
One function, many types, resolved at compile time.
-
5.2
Class templates
Containers and wrappers that work for any element type.
-
5.3
Deduction and forwarding
How types are worked out, and how to pass them on unchanged.
-
5.4
Concepts and constraints
Saying what a template requires, and getting a readable error when it is not met.
-
5.5
Compile-time computation
Work the compiler does so the program does not have to.
-
5.6
Variadic templates
Functions and types that take any number of arguments.
-
5.7
Type traits and metaprogramming
Asking and answering questions about types at compile time.
-
5.8
Static polymorphism
Getting the shape of inheritance without the runtime cost.