CppCon 2019 has ended
Back To Schedule
Thursday, September 19 • 14:00 - 15:00
Back to Basics: Function and Class Templates

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Generic programming is a collection of techniques for implementing software components that you can adapt easily for a variety of uses. In C++, templates are the primary tool for generic programming, and they're used throughout the standard library. Templates can be functions or classes, as well as variables or type aliases.

This session is for C++ programmers who would like to shore up their understanding of templates. It describes many C++ template features and offers insights into how compilers use compile-time information, such as types and values, to process templates.

This session begins by showing how to define function templates and how call them using explicitly-specified or deduced template arguments. It then covers class templates, including the behavior of static data members, friends, and nested classes appearing in class templates. It explains why template definitions require explicit qualification or the keyword typename in some situations. It presents the different forms of template parameters and corresponding arguments, as well as default arguments. Throughout, it clears up common misunderstandings regarding templates, such as the differences among the mechanisms of instantiation and the different flavors of specialization.

avatar for Dan Saks

Dan Saks

President, Saks & Associates
Dan Saks is the president of Saks & Associates, which offers training and consulting in C and C++ and their use in developing embedded systems. Dan used to write the “Programming Pointers” column for embedded.com online. He has also written columns for numerous print publications... Read More →

Thursday September 19, 2019 14:00 - 15:00 MDT
Aurora D