Beautiful Type Erasure with C++26 Reflection

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.
117 points by RyanJK5 99 days ago ryanjk5.github.io 58 comments
Summary not yet generated for this article.

Original Text

Try it on Compiler Explorer: https://godbolt.org/z/91dj5jeGW

Check out the source code: https://github.com/RyanJK5/rjk-duck

Comments (58 of ) ⌛

Loading more comments... ⌛
Scroll down to load more comments
No comments available.
Type to search HN and engineering blog articles
Press Escape to close  |  ↑↓ to navigate  |  Enter to open