Loading…
Attending this event?
View analytic
Thursday, September 27 • 16:45 - 17:45
Class Template Argument Deduction for Everyone

Sign up or log in to save this to your schedule and see who's attending!

Class Template Argument Deduction (CTAD) is a C++17 Core Language feature that reduces code verbosity. C++17's Standard Library also supports CTAD, so after upgrading your toolset, you can take advantage of this new feature when using STL types like std::array, std::greater, std::pair, and std::vector. Class templates in other libraries and your own code will partially benefit from CTAD automatically, but sometimes they'll need a bit of new code (deduction guides) to fully benefit. Fortunately, both using CTAD and providing deduction guides is pretty easy, despite template metaprogramming's fearsome reputation!

This presentation will contain three parts: using CTAD in everyday code, providing deduction guides in library code, and understanding corner cases. For everyday code, we'll explore how CTAD makes using the STL easier, eliminating annoying angle brackets filled with redundant info. All programmers, from beginners to experts, will benefit from typing and reading less code. Next, for library code, we'll see how to distinguish situations where CTAD automatically works versus those where deduction guides are needed, and how to write those guides. Finally, we'll examine some corner cases that illustrate how CTAD works in complicated scenarios, including issues recently resolved in the Standard.

Speakers
avatar for Stephan T. Lavavej

Stephan T. Lavavej

Principal Software Engineer, Microsoft
Stephan T. Lavavej is a Principal Software Engineer at Microsoft, maintaining Visual C++'s implementation of the C++ Standard Library since 2007. He also designed a couple of C++14 features: make_unique and the transparent operator functors. He likes his initials (which people can... Read More →


Thursday September 27, 2018 16:45 - 17:45
B

Attendees (64)