CppCon 2018: Stephan T. Lavavej “Class Template Argument Deduction for Everyone”

CppCon · 12K views · 2018 · 1:00:42

Open on YouTube

C, C++, Rust, Go & systems languagesProgramming language designtalk

Why Stack Overflow recommends it

Stack Overflow users link it when answering CTAD and deduction guide questions, since it covers the finer details that the standard text makes hard to follow.

Recommended by 3 people across 3 different months, 2018 to 2023.

What it is

Stephan T. Lavavej of Microsoft explains C++17 Class Template Argument Deduction (CTAD) in a one-hour CppCon 2018 talk. He covers everyday use with STL types, writing deduction guides for library code, and corner cases including recently resolved standard issues.

What people said

Strong rec NathanOliver · 2021-04 · Stack Overflow · on “Do deduction guides require noexcept specifiers?”

@skypjack You're welcome. If you have an hour, you should give this talk [this video] a watch. It gets into a lot of the finer details and really does a good job explaining the whole thing. Stephan T. Lavavej did a great job IMHO.

Recommends Chris Uzdavinis · 2022-06 · Stack Overflow · on “C++ class templates can be implicity specialized and instantiated without angle brackets?”

Stephen Lavavej's talk on CTAD should answer all your questions (and a few you probably didn't think to ask) [this video]

Recommends Qaz · 2023-04 · Stack Overflow · on “Why does std::vector CTAD accept both int and double?”

@KarenBaghdasaryan, I was deliberately avoiding the standard itself on this one because there's no telling how long I'd be trapped in there, but I can offer this CppCon video [this video] (at the relevant slide). I wonder if the proposal has motivation for allowing different results when a constructor or its generated guide is chosen in both cases or if the idea was to layer CTAD on top and that fell out as just a consequence.

Cites Massimiliano · 2018-11 · Stack Overflow · on “When does type information flow backwards in C++?”

I just watched Stephan T. Lavavej talk at CppCon 2018 on "Class Template Argument Deduction", where at some point [this video] he incidentally says: In C++ type information almost never flows backwards ... I had to say "almost" because there's one or two cases, possibly more but very few . Despite trying to figure out which cases he might be referring to, I couldn't come up with anything. Hence the question: In which cases the C++17 standard mandates that type information propagate backwards?