C++ Templates for Developers is a two-day onsite training course with programming examples, taught by Walter E. Brown. It is offered at the Gaylord Rockies from 09:00 to 17:00 Aurora time (MDT) on Saturday and Sunday, September 17th and 18th, 2022 (immediately following the conference). Lunch is included.
As an intermediate-level C++ programmer, you already know about and have very likely used one or more kinds of C++ templates in your code. Whether you’ve applied std::vector or std::array to your work, or called upon any of the multitude of algorithms that the standard library provides, you’ve experienced some of the power that templates add to a C++ programmer’s toolkit.
This Workshop will help you take your knowledge and experience to the next level, so that you will both (1) understand exactly how C++ templates are handled by a compiler, and (2) be able to take advantage of that knowledge to create templates that are tailored to your own programming needs.
In this Academy Workshop, we will explore all significant facets of the many kinds of C++ templates (and other templated entities), and will do so in as much depth as our time together will permit. The Workshop will include presentations as well as optional (but recommended) practice exercises, together with numerous examples and tips that you can learn from and apply. Many of our examples and exercises will be taken from the standard library, thus doubling the useful information you’ll glean from your participation.
Come discover how the world of C++ templates will open to you once you’ve mastered a modest handful of straightforward, key insights and principles. Whether it’s programming generically, or with variadics, SFINAE, concepts, overloading, or other coding practices, this Workshop will allow you to explore and apply template-based techniques that will help solve problems in your programming domain!
Attendees should have good intermediate-level C++ knowledge with at least one to two years of recent C++ coding experience.
Those planning to do the recommended exercises should bring their preferred development environment. A compiler that supports C++20 (e.g., GCC12+) is recommended, but C++17 support will suffice for this Workshop.
We will emphasize principles that will allow you to reason about template technology. To that end, the Workshop expects to cover the following representative topics in the time available (not in the order listed):
- Kinds of templates
- alias templates
- class templates
- deduction guides
- function templates
- generic lambdas
- variable templates
- Template processing and mechanics
- declaration synthesis
- deduction guides
- default template arguments
- dependent and non-dependent names
- function objects
- non-deduced contexts
- reference collapsing
- specialization (implicit, explicit, partial)
- substitution / substitution failure (SFINAE)
- template arguments / argument deduction
- template instantiation and its control
- template parameters (type, nontype, and template)
- two-phase name lookup
- Related C++ language features
- constraints / requires-clauses
- if constexpr
- variadic templates / parameter packs / pack expansion / fold expressions
- Library facilities
- constants as types
- function and friends
- invoke and friends
- traits for inspecting types
- traits for manipulating types
- Classical techniques / practices / idioms
- perfect forwarding
- tag dispatch
- template metaprogramming
- void_t and the detection idiom
With broad experience in industry, academia, consulting, and research, Dr. Walter E. Brown has been a computer programmer for almost 60 years, and a C++ programmer for more than 40 of those years.
He joined the C++ standards effort in 2000, and has since written circa 175 proposal papers. Among numerous other contributions, he is responsible for introducing such now-standard C++ library features as cbegin/cend, common_type, gcd/lcm, void_t, and <cmath>’s mathematical special functions, as well as the headers <random> and <ratio>. He has also significantly impacted such C++ core language features as alias templates, contextual conversions, variable templates, static_assert, and operator<=> (the C++20 “spaceship operator”).
When not playing with his grandchildren, Dr. Brown continues as an Emeritus participant in the C++ standards process and as a frequent speaker at C++ conferences and meetups worldwide. Attendees and video viewers have described his talks with such accolades as:
- “Fantastic speaker”
- “Impressive. Thank you”
- “As usual very clear presentation. Content is great, slides have the right level of complexity.”
- “I think Walter E. Brown is the teacher I never had.”
- “For a moment I was like I know these issues but thankfully I ignored that thought.”