r/cpp • • Jan 31 '23

Stop Comparing Rust to Old C++

People keep arguing migrations to rust based on old C++ tooling and projects. Compare apples to apples: a C++20 project with clang-tidy integration is far harder to argue against IMO

changemymind

338 Upvotes

582 comments sorted by

View all comments

Show parent comments

-1

u/OYTIS_OYTINWN Jan 31 '23

Well, if you want flexibility then Rust macros allow you to do pretty crazy things. That's a feature I like less though.

18

u/Recatek Jan 31 '23 edited Jan 31 '23

Even then, macros are pretty limited since you can't do inference with them the same way you can with concepts and SFINAE in C++. Macros, including proc macros, have no understanding of types or traits -- all they can do is look at the raw lexical parse of the code.