Conference | Live Schedule | Talks | Get your ticket | Slides | Set your timezone
Static and Dynamic External Polymorphism in C++23 and Beyond

Andreas Pfaffenbichler
On Day 2 at 16:00 (CET/Berlin) in Track B [Opal Room and online]
The C++ "built-in default" for polymorphism is "Inheritance".
Over the last 20 years, it became clear: separating the interface from the implementation is in many aspects superior. These two adjacent approaches got named "Internal" and "External Polymorphism".
While Rust pioneered first class language support for the latter paradigm, libraries showed up to bring this approach to the C++ world.
After we gained an overview of the "Polymorphism Landscape" in C++, we will use Any++, a C++23 based library to show how complicated design patterns can be elegantly addressed with External Polymorphism, when:
- Known C++ runtime super powers like Downcasting and Crosscasting are also supplied
- Open (Multi)-Methods are integrated. E.g. for visitors and binary Type Erased operators.
- Flexibility of Type Erasure is combined with the performance of std::variant
- Type Erasure is merged with Templates
- The v-table is replaced with type based Static Dispatch (Concept Maps!)
To achieve this functionality without boilerplate, Any++ had to resort to a preprocessor based EDSL.That is not a romantic setting to fall in love at first sight.
Luckily C++26 is around the corner! In the last chapter we will show, how a boilerplate free API with the functionality of Any++ can be provided with C++26's generative reflection mechanisms.
Please login to comment