From Runtime to Compile-time with Petra

Speaker: Jackie Kay

Audience level: Intermediate | Advanced

category

Petra is an experimental C++17 metaprogramming library providing conversions from runtime-determined values to their equivalent compile-time representations. This talk will demonstrate how techniques such as jump tables and constexpr string hashing can be used to implement these mappings for integers, enums, strings, and more complex aggregate types.

To show the library's usefulness, we will give an overview of an implementation of a heterogenous map with immutable keys and runtime-mutable values. We will also discuss how this library could make metaprogramming more useful by providing an interface for values read from a file or user input to "memoized" compile-time algorithms.

https://github.com/jacquelinekay/petra