How and when to write a template

Roth Michaels

⏱ 60 minute session
beginner
09:30-10:30, Friday, 5th July 2024

Let’s break down mysteries around templates!

C++ templates (and other compile time programming techniques) are both a feature that sets C++ apart from other languages and a feature that many developers find challenging or maybe just avoid.

Our main focus in this talk will be on building an understanding of when templates are a tool worth reaching for—and when you may not and are just getting too fancy. We will see how to use templates for generic programming and cover some of the more confusing topics related to generic programming such as how templates work with overloading and how template specializations work. While the language rules for these topics are quite complex, we will try to build an intuitive understanding that will support us in common use cases.

We will then take a look at template metaprogramming and how it can be useful for compile time programming or code generation. We will compare and contrast traditional template metaprogramming techniques with modern utilities available in C++14, C++17, and C++20; and see where we still would like to use templates.


🏷 templates
🏷 constexpr
🏷 consteval
🏷 generic programming
🏷 metaprogramming

Roth Michaels

Roth Michaels is a Principal Software Engineer at Native Instruments, an industry leader in real-time audio software for music production and broadcast/film post-production. In his current role he is involved with software architecture and bringing together three merged engineering organizations and legacy codebases: Brainworx, iZotope, and Native Instruments. He also supports the Audio Research team to help accelerate moving research to productization and developing fast prototyping tools for product teams. Before merging with Native Instruments, when he joined iZotope, Roth was the lead library designer of a new internal cross-platform "Glass", part of which is now available as open-source. More recently in his former role as Mix/Master Software Architect, Roth helped develop the reference implementation to move iZotope's products to subscription and led the team that launched the company’s first SaaS offering for music producers. Roth studied music composition at Brandeis University and continued his studies in the Dartmouth Digital Musics program. Roth began his career in software development writing software for his own compositions, and the works of other composers and artists, and teaching MaxMSP to composers and musicians; both private instruction and designing university courses. Before joining iZotope, he was working as a consultant for small startups working on mobile applications specializing in location services and Bluetooth.