25–29 May 2026
Chulalongkorn University
Asia/Bangkok timezone

Compile-Time Metaprogramming with C++26 and beyond in HEP

26 May 2026, 16:15
18m
PHYS1 204

PHYS1 204

Oral Presentation Track 6 - Software environment and maintainability Track 6 - Software environment and maintainability

Speaker

Jolly Chen (CERN & University of Twente (NL))

Description

C++ compile-time metaprogramming techniques - commonly known as “templates” - are extensively used in HEP code to write reusable code and perform optimisations at compile-time. In 2026, the new C++26 standard will be released, including major new compile-time programming features such as reflection, template for, constexpr if, constexpr allocations, consteval, etc. Reflection could make compile-time metaprogramming significantly less complex, but it involves a learning curve as it is vastly different from existing techniques such as preprocessor macros and templates. Reflection could also play a role for data serialisation (for instance in the context of ROOT I/O), for optimising memory layouts, and for creating Python bindings.

This presentation will showcase compile-time metaprogramming using C++26 reflection, providing examples of how and where it is useful to guide the writing of maintainable C++ code in HEP software. Additionally, we preview some exciting new code generation features proposed for future standards.

Author

Jolly Chen (CERN & University of Twente (NL))

Presentation materials