July 2025
Beginner to intermediate
402 pages
8h 8m
English
We have used class templates in previous examples in this book without explaining them in detail. You should by now have a basic understanding of templates in C++ and know how to use template container classes from the standard library to specialize containers with different underlying types. We have also covered the std::optional and std::expected template classes, which we can use to handle different return types from functions.
As you have already seen, templates are used heavily in the C++ standard library. They allow us to implement the same functionality for different types, making our code reusable and generic, which is one of the strengths of C++. Templates are an extremely complex ...
Read now
Unlock full access