Hacker News new | ask | show | jobs
by bjz_ 1933 days ago
They are differently powerful. Rust's macros can let you extend the syntax and do context-free code generation, where as C++ can let you to type-directed code generation. You can do the latter in Rust using trait dispatch, but it's more awkward and less expressive than what C++ has.
1 comments

It's not a panacea, but enum_dispatch seems to help a lot: https://docs.rs/enum_dispatch/0.3.5/enum_dispatch/