Summary
This episode continues the exploration of C++17's class template argument deduction by focusing on deduction guides, a feature that enables template type deduction for classes where the constructor parameters don't directly map to template parameters. Jason demonstrates how deduction guides allow classes like std::function, which couldn't automatically deduce their template arguments in the previous episode, to work with C++17's template deduction. By writing custom deduction guides that specify rules for converting constructor argument types to template parameter types, developers can extend automatic template argument deduction to more complex template classes.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[temp.deduct]72% match -
[temp.arg.type]71% match -
[dcl.type.class.deduct]65% match -
[temp.arg.explicit]63% match -
[namespace.constraints]60% match -
[temp.deduct.general]60% match -
[temp.deduct.guide]59% match -
[temp.over.link]59% match -
[temp.deduct.type]57% match -
[basic.lookup.argdep]56% match - + 6 more related sections