Search⌘ K
AI Features

Template Argument Deduction for Class Templates

Explore how C++17 introduces Class Template Argument Deduction (CTAD) that allows automatic deduction of template parameters for class templates. This lesson helps you understand how using CTAD reduces complexity in templated object construction by eliminating the need for many helper functions like make_Type, improving code readability and maintainability.

We'll cover the following...

Do you often use make_Type functions to construct a templated object (like std::make_pair)? With C++17 you can forget about (most of) them and just use a regular constructor.

C++17 has filled a gap in the deduction rules for templates. Now template deduction can occur for standard class templates and not just for functions. That also means that a lot of your code that uses make_Type functions can now be removed.

For instance, to ...