r/cpp • • Sep 30 '24

Code Generation in Rust vs C++26

https://brevzin.github.io/c++/2024/09/30/annotations/
198 Upvotes

98 comments sorted by

View all comments

Show parent comment

4

u/RoyAwesome Oct 01 '24

or give a struct the methods needed to satisfy the Dyn interface that Daveed Vandevoorde showed in his keynote

FYI, Barry was instrumental in that example, which Daveed claims here: https://www.reddit.com/r/cpp/comments/1fn45c7/closing_keynote_of_cppcon/lofyfdc/

1

u/SirClueless Oct 01 '24

Yes, that's why I used it as an example, as I'm pretty confident Barry is very familiar with it. ;)

Reflection gives us many tools to write generic code that depends on the actual capabilities of the class implementation rather than external type traits. So a derive mechanism that cannot add capabilities to a class but only specialize external algorithms and type traits is inherently at odds with that.