Speaker
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.