Back To Schedule

Reflect `*this`!

Design and Implementation of a Pragmatic Mixin Library with Static Reflection

09:00 - 10:30 Tuesday 9th May 2023 MT Bethe Hall
Intermediate
Advanced
Future C++

Mixin libraries provide significant productivity boost for developers, by allowing them to state directly the needs for their type (hashing, serialization, debug-printing, etc) while delegating the tricky implementation details to preexisting libraries. We present a static-reflection-based mixin library, building on the ideas of several open source libraries, including BOOST_FUSION_DEFINE_STRUCT, and Antony Polukhin's magic_get (now Boost.PFR).

This talk is deep-dive into the technical details of our implementation, as well as the design space for mixin libraries in general. For the implementation details, we'll go into enough depth that you could implement the library yourself. We'll cover details including how users can specify their own mixins, how mixins are able to depend on one another, and how we support both aggregate and non-aggregate types. In discussing the design space, we'll explain the choices and tradeoffs that we made, under what circumstances you might make different tradeoffs. We'll explore further possibilities including heavier use of Clang's __builtin_dump_struct, benefits that future language versions will provide, and other libraries that can be built with this as a foundation.

View Slides

Andy Soffer

Software EngineerBrontoSource

Andy Soffer is a lapsed mathematician turned software engineer. He spent eight years at Google, before founding BrontoSource in late 2024. His time at Google culminated in leading the C++ Core Libraries team (responsible for Abseil and GoogleTest) and the C++ Large Scale Refactoring team, responsible for building and executing multimillion line migrations across the codebase. At BrontoSource, he is excited to share what he has learned about effective automated refactoring techniques with the rest of the C++ community.