Generic Programming Templates in C++
Explore the power of C++ templates, from function and class basics to advanced features like instantiation and concepts, enhancing code flexibility, reusability, and abstraction without performance loss.
I've been giving seminars about modern C++ and Python since 2004. My books "C++ 11 für Programmierer ", "C++" and "C++ - Standardbiliothek" for the "kurz & gut" series were published by the publisher Pearson and O'Reilly. They are available in German, English, and Korean. Additionally, I published two books at LeanPub: "Concurrency with Modern C++", and "C++20: Get the Details". I'm the author of the two well-known blogs mentioned above.
Join 3.1 million developers at
What You'll Learn
- Define and use function templates with correct parameterization, overloading, and explicit type specification
- Build class templates using alias templates, method templates, and inheritance to create reusable generic types
- Apply type, non-type, and template-template parameters to design templates with flexible compile-time inputs
- Use template argument deduction and default arguments to instantiate function and class templates effectively
- Implement primary, partial, and full specializations and predict compiler selection among specializations
- Develop variadic templates with fold expressions and perfect forwarding to process arbitrary argument packs
- Constrain templates with C++ type traits, constexpr/constexpr if, and C++20 concepts for safer generic code
Learning Roadmap
1.
Introduction
Introduction
2.
Basics
Basics
3.
Details
Details
18 Lessons
18 Lessons
4.
Techniques
Techniques
18 Lessons
18 Lessons
5.
Design
Design
24 Lessons
24 Lessons
6.
Future
Future
7 Lessons
7 Lessons
7.
Conclusion
Conclusion
2 Lessons
2 Lessons
Rainer Grimm
I’ve worked as a software architect, team lead, and instructor since 1999. I like to write articles on the topics C++, Python, and Haskell in my spare time. I often speak at conferences.
Trusted by 3.1 million developers working at companies
Anthony Walker
@_webarchitect_
Evan Dunbar
ML Engineer
Software Developer
Carlos Matias La Borde
Souvik Kundu
Front-end Developer
Vinay Krishnaiah
Software Developer
Built for 10x Developers












Free Resources