4 ms·
No, they are not.
by menaerus 7mo ago
No, they are not.
- aldanor 7mo agoIncorrect.
- deleted 7mo ago[deleted]
- aw1621107 7mo agoThey are both; there are things that Rust's macros can do metaprogramming-wise that C++ templates cannot do and vice-versa. Rust's macros work on a syntactic level, so they are more powerful in that they can work with "normally" invalid code and perform token-to-token transformations (and in the case of proc macros effectively function as compiler extensions/plugins) and less powerful in that they don't have access to semantic information.