CppCon 2018: Timur Doumler “Class template argument deduction in C++17”

preview_player
Показать описание


Class Template Argument Deduction (CTAD) is a very useful C++ language feature that was added in C++17. This talk is a comprehensive and practice-oriented introduction to this new technique.

In this talk I'll present how CATD and automatic deduction guides let you write cleaner and shorter code, show how to interact with it when using the C++ standard library and when designing your own classes, explain when and how user-defined deduction guides should be used, and cover the language rules behind all of this.

We will also discuss the various pitfalls that lie in wait: wrong and surprising template arguments being deduced, your constructor not being selected even if you think it should be, and automatic CTAD sometimes leading to unsafe and broken code – and how to circumnavigate those pitfalls.

Timur Doumler, JetBrains



*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

thks for simplifying ctad. all your c++ talks are informative and easy to understand complex c++ lang, but i think there is typo on slide no.26 the last comment is out of sync. its "p2" not "p1"

sanjaygatne
Автор

There are no such things in C++ as templated classes or functions, there are class and function templates. As Walter Brown puts it, milk chocolate and chocolate milk are totally different things.

eugnsp