English
Topic 12. Function and class templates, concepts
Goal: learn to design templates, express requirements with concepts and test allowed and forbidden instantiations.
Lecture contents
- Function templates and concepts — Generalization as preserving rules · Function parameters and type deduction · A numeric type concept and a complete example
- Class templates — A class template and a non-type parameter · Default arguments and dependent names · Specialization and overloading · Definition visibility and linker errors
- Parameter packs and requires — Parameter packs and fold expressions · The requires clause, the requires expression and standard concepts · Diagnostics and negative tests · Static polymorphism and the final choice