Beautiful Type Erasure with C++26 Reflection
The article introduces 'rjk::duck', a new C++26 library that simplifies type erasure using advanced reflection features. It allows developers to define interfaces and handle polymorphic types without the boilerplate code typically associated with older C++ techniques.
Why it matters
It demonstrates the power of upcoming C++26 standards to reduce code complexity and improve performance in systems programming.
If you’ve ever tried using type erasure for something more complicated than std::any or std::function , you’ve either written 100+ lines of easy-to-mess-up code or reached for a boilerplate-heavy library like Boost.TypeErasure or Folly.Poly . rjk::duck uses the magic that is C++26 reflection to remove these pain points while preserving all of the customization and performance.
Purely technical discussion of a programming library.
Get smarter about the news
Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.
Create free accountAlready have an account? Sign in