Loading…
Thursday September 17, 2026 16:45 - 17:45 MDT
Non-intrusive runtime dispatch in C++ has never had a clean answer. Virtual functions couple your interface tightly to its implementation, type erasure libraries tend to rely on macros or templating magic, and manual vtables are boilerplate-heavy and easy to get wrong. C++26 reflection changes that: you can now tell the compiler to synthesize a vtable for you at compile time from a simple interface declaration, with zero overhead compared to hand-written virtual dispatch. The duck library is built on exactly that idea. This talk explains how duck works through the story of how it came to exist. A required data structures college course stuck firmly in C++11 sparked the speaker's curiosity in modern C++, leading him to view conference talks and proposals on C++26 reflection. Experimentation with Compiler Explorer turned into the discovery that reflection can be used to generate vtables, simulate overload sets, reduce dispatch overhead, and more. Viewers will be introduced to C++26 reflection's core operations and code generation mechanisms, grounded entirely in real use cases from duck's implementation. We'll look at how existing approaches struggle with generality, and the central technique that lets duck overcome this: using define_aggregate both to synthesize a vtable struct from a reflected interface and to simulate member function call syntax directly on a duck. A blog post about the project led to an invitation to CppCon and an introduction to the authors of P4148 (protocol), an upcoming proposal aiming to get a library feature similar to duck into the C++29 standard. We'll close with a preview of P4148, as well as a look at how more powerful generative programming like token injection (P3294) can improve the implementation of duck and fundamentally shape the future of metaprogramming in C++.

Presenters
RK

Ryan Keane

Ryan Keane is a second-year computer science student at Rensselaer Polytechnic Institute and the creator of duck, a C++ reflection library for non-intrusive interfaces. After writing a blog post about the library's internals, he was invited to speak at CppCon and is now collaborating... Read More →
Thursday September 17, 2026 16:45 - 17:45 MDT
_6

Log in to save this to your schedule, view media, leave feedback and see who's attending!

Share Modal

Share this link via

Or copy link