Photo of Walter E. Brown

Walter E. Brown

With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a C++ programmer for more than 35 of his 50+ programming years. He joined the C++ standards effort in 2000, and has since written almost 150 proposal papers. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend, common_type, gcd/lcm, and void_t, as well as all of the <random> and <ratio> headers. He has also significantly impacted such core language features as alias templates, contextual conversions, variable templates, static_assert, and the forthcoming spaceship operator.

When not playing with his grandchildren, Dr. Brown is an Emeritus participant in the C++ standards process, with several more proposals under consideration.

C++ Function Templates: How Do They Really Work?

Tuesday 09:00
90 minute presentation
Advanced
Intermediate
Beginner

After a brief introduction to the syntax and semantics of C++ function templates, we will focus on processing this much-misunderstood language feature in the context of the rest of the language.

Specific topics will include function declaration synthesis and function definition instantiation from a function template, and template argument deduction from function call arguments. We will also touch on function templates' interaction with such other compiler algorithms as name lookup, overload resolution, partial ordering, and more.

Along the way, we will debunk a few of the more prevalent myths about function templates. We’ll also look carefully at function template specialization, explaining why to avoid explicit ones, and recommending what to do instead.

Finally, we'll briefly explore some recent WG21 proposals regarding function templates in the C++20 core language and standard library.