From Jason Turner
Watch on YouTube

Summary

This episode explores C++17's class template argument type deduction, a feature that eliminates the need for explicit template arguments or maker functions when instantiating template classes. Jason demonstrates how this feature allows for cleaner code by directly constructing objects like std::tuple without specifying template parameters. He also discusses important caveats: the actual inferred type is still specific and type checking is strict (demonstrated with type mismatch errors), and deduction doesn't work for all template classes, particularly those like std::function that have complex relationships between constructor arguments and template parameters.

Resources

Tags