Chapter 15. Templates, C++20 Concepts and Metaprogramming

Images

Objectives

In this chapter, you’ll:

Appreciate the rising importance of generic programming.

Use class templates to create related custom classes.

Understand compile-time vs. runtime polymorphism.

Distinguish between templates and template specializations.

Use C++20 abbreviated function templates and templated lambdas.

Use C++20 concepts to constrain template parameters and to overload function templates based on their type requirements.

Use type traits and see how they relate to C++20 concepts.

Test concepts at compile-time with static_assert.

Create a custom concept-constrained ...

Get C++20 for Programmers, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.