Back To Schedule

Templates made easy with C++20

how constexpr/consteval, fold expressions, and concepts change how we write code

19:45 - 20:45 Saturday 2nd March 2024 UTC
Generic / Metaprogramming

C++ templates are a powerful tool for compile-time programming, generic programming, and metaprogramming. Historically many of these techniques have been considered advanced techniques or even arcane-magic by many C++ developers. Complex error messages and concepts like SFINAE being hard to teach can leave use of C++ templates out of reach—if you don’t know what SFINAE, come to this talk and find out what it is and why you might not need to use it anymore.

With C++17/20, constexpr, consteval, concepts, and fold expressions can change the way we teach a write C++ for compile-time programming, generic programming, and metaprogramming. This talk will cover these new C++ features and show how they change the templated C++ one would have written in the past.

After demonstrating how to use and write concepts, we will look at some examples of production UI library code that can be simplified to be easier to write and understand by adopting C++20 concepts combined with constexpr/consteval and fold expressions.

See lessons learned by teams that have moved to C++20 and started using concepts, and how your teams could benefit from these features in the latest C++ standards.

View Slides

Roth Michaels

Principal Software EngineerNative Instruments

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 at Native Instruments he works on the integration of three merged companies and their legacy C++ codebases. When he joined iZotope/Native Instruments, 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 and Native Instruments, he was working as a consultant for small startups working on mobile applications specializing in location services and Bluetooth.