
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
The slide deck for this course.
Note: The slide deck is password protected. Open as read-only when prompted for a password.
Demonstrates usage of C functions such as qsort, abs, labs, etc. This gets you started in understanding why templates are required.
Using macros as an alternative to templates and how it causes more problems than it solves.
Introduction to templates and their basic syntax.
All the source code for this section is in separate folders in the zip file
The batch file for undecorating multiple decorated names at once.
Basic usage of function templates.
Understand what template argument deduction is and how templates are instantiated by the compiler.
Some templates require explicit template arguments. Learn about their properties & usage.
Understand the usage of default arguments in function templates.
Understand the internals of how the arguments are converted when function templates are invoked.
Learn about the usage of which specifiers are useful with templates.
Templates with non-type template arguments and how they can be useful.
See how function template are overloaded along with normal functions.
Specialization is a process of defining a template for a particular type so that it can have right semantics. Understand the process and its usage.
See how overloading behaves when explicit specializations are provided.
Understand the template instantiation process in depth.
Understand the basics of explicit template instantiation and why is is required.
Examples of explicit instantiations.
More examples of explicit instantiation.
Understand the types of compilation models and which one is adopted by the C++ compilers & the reasons thereof.
Learn about the motivation of this C++11 feature and its usefulness for templates.
Implications of putting static variables in function templates.
Overview of class templates and their purpose.
Basic example of class template.
Testing the class template for correctness.
Using a class template as a template argument.
C++17 introduced a way for a class to deduce template arguments automatically from the constructors. Learn about this feature in this lesson.
Understand the process of class template instantiation.
See the effect of using extern on class templates and how it reduces code bloat.
Creating static member functions inside class templates.
Understand the syntax of explicitly specialization member functions of a class template.
Basic example of explicit specialization of a class template.
Continuing with the previous example, this class adds a default specialization for printing the elements of the Stack.
Simplifies the usage of Stack with the Printer class, by providing the Printer as a default template argument.
Understand how non-type template arguments can be used with class templates.
Introduction to the concept of partial specialization.
More examples of partial specialization.
Fixing the example creating in the previous lesson through partial specialization.
Source code for this section
Explore how function templates receive arguments by value, reference, const reference, or address; distinguish lvalues and rvalues, and examine copy, move, and type information.
Pass function template arguments by reference, const reference, or address, noting rvalue limits, array and pointer deductions, and forwarding references with examples like std::advance, std::swap, and std::get.
Explore forwarding references in modern c++ templates, showing how rvalue references preserve value category through type deduction and enable efficient forwarding with std::forward.
A high-level overview of the features added for templates in C++11/14/17/20.
The right angle bracket problem & its solution in C++11
Overview of type definitions.
C++11 introduced a new way of creating aliases. Learn how to use this feature and how it is more useful than simple type definitions for templates.
Learn what are extern templates and their significance in reducing template bloat.
This lecture introduces variadic templates and their structure.
An example usage of variadic templates.
Explanation of the variadic sizeof... operator and its usage.
A basic example of how to create variadic classes and their usage.
This lesson explains real use cases where variadic templates are useful and there usage in the standard library.
Explanation of the C++14 template features.
See how compile-time if simplifies template programming & makes the code easier to write.
Learn about C++17 fold expressions and how they simplify working with variadic templates without the need for recursion.
Learn about the auto placeholder for non-type template arguments.
Learn the new feature of using literal types as non-type template parameters, including user-defined literal types.
This lecture discusses the shortcomings of using lambdas prior to C++20.
See how template parameters in lambda expressions simplify lot of issues in the examples shown in the previous lesson.
Learn about abbreviated auto; a new way to create generic algorithms along with C++20 concepts.
List source code
Explanation of the project.
Implementation of the Add & Print method.
Implementing traversal.
Adding unit tests for the list class.
Implementation of the Insert method.
Implementation of the Erase method.
In this lecture, we'll customize the Print function by adding a separate printer class that can be either completely replaced by the users or explicitly specialized for custom printing .
We'll use Modern C++ features to improve the List class through variadic templates, perfect forwarding, etc.
Congrats on finishing the course. You can find more courses at learning.poash.com
Welcome to a comprehensive course on Modern C++ Templates! This course is designed to provide a deep understanding of the changes and advancements in C++ template programming from C++11 to C++20. The course equips learners with the knowledge and skills to master modern template techniques.
Learn about C++11 alias templates in two detailed lessons, covering how to simplify complex type declarations and enhance code readability. Explore extern templates and understand their role in reducing compilation times.
Delve into variadic templates across five lessons, discussing their syntax, usage, and applications. These lessons provide the tools to create flexible and reusable code that can handle an arbitrary number of arguments. Following this, learn about the changes introduced in C++14 and C++17, including the powerful fold expressions and the auto non-type feature, further streamlining template programming.
In the C++20 segment, learn about non-type template parameters (NTTP) and how they improve template flexibility. Explore template lambdas in three comprehensive lessons, learning to use them for more concise and expressive code. The course concludes with an exploration of the abbreviated auto feature, simplifying type declarations and improving code clarity.
This course not only covers the theoretical aspects of modern C++ templates but also provides practical guidance on how to apply these techniques in real-world scenarios. It demonstrates the usage of using templates with examples from the standard library & other C++ libraries. Utilized templates to write more efficient, maintainable, and expressive code.
By the end of this course, gain a thorough understanding of modern C++ template features and be able to apply them effectively in projects.