Talk

Three and a Half Variants of the variant

Hall 2

While investigating an incorrect cell fill color calculation in a spreadsheet editor, I noticed unusually long compilation times for a small file with simple computations. The first suspect was the template boost::variant<Transform1, Transform2, …, Transform28>. Profiling compilation time with Clang’s -ftime-trace confirmed my suspicion: 90% of the time was spent instantiating this template.

Research pointed to two main candidates to replace the outdated implementation: std::variant and boost::variant2.

In this talk, we will explore how variant works internally, the real trade-offs between different implementations, common pitfalls when migrating, and alternative approaches to solving problems typically handled by variant. We’ll cover not only compile-time aspects but also runtime behavior, memory usage, and reliability, drawing on real-world incidents encountered during the development of document editors.

Speakers

Invited experts

Schedule