C++ Class Template Argument Deduction - History, Uses, & Enabling it for Classes - Marshall Clow

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

C++ Class Template Argument Deduction - History, How to Use it, and How to Enable it for Your Classes - Marshall Clow - CppCon 2022

In C++17, a new feature "Class Template Argument Deduction" (CTAD for short) was added to the language.

In this talk, I will show the rationale for this feature, how you can use it in your code, explain how it works and give examples of how to enable it for your classes.
I'll answer questions like:
* Why did the committee add this feature to the language?
* Why "class template argument deduction"? Why not just "template argument deduction"?
* What is a deduction guide?
* What can be done in a deduction guide?
* How do I write my own deduction guides?
* What tools are there for debugging deduction guides?

I will also talk about enhancements since C++17, and possible future directions.
---

Marshall Clow

Marshall has been coding for 40+ years; he was the lead developer on libc++ for 10 years, and the chairman of the Library working group of the C++ standards committee for 5 years. These days, he spends his time looking at "interesting problems"
---

#cppcon #programming #cpp
Рекомендации по теме
Комментарии
Автор

39:30 A good C++ template joke: "When stuff misbehaves you get to see the smoking remains"

JATmatic
Автор

About the question if requires clauses are valid for deduction guides: Yes, you can use requires clauses on deduction guides.

Bolpat
Автор

​I wish compilers’ error messages wouldn’t spell out default template arguments. Also, why print namespaces, assuming the symbol is unambiguous.

Bolpat
Автор

What the fuck were those questions???? "Can you use template deduction with a member function?" TF? Have you ever used a template?

PlexiumGames