3 ms·
> relying on raw string concatenation > it's not so bad You can always use the C preprocessor in C++ if raw string manipulation is enough. Seriously, though,
by beojan 9y ago
> relying on raw string concatenation
> it's not so bad
You can always use the C preprocessor in C++ if raw string manipulation is enough.
Seriously, though, constexpr means C++ also has static if, compile time loops, function eval, etc.
- jordigh 9y agoRaw string manipulation in D's mixins is much more limited than in CPP, and it's also not the only tool available for metaprogramming. https://dlang.org/mixin.html https://dlang.org/mixin.html > constexpr means C++ also has static if, compile time loops, function eval, etc. It's still not quite the same. I'm sorry to not bring examples, but if you look for them yourself, I think you'll find that D's metaprogramming looks nicer than C++'s constexpr.
- nicwilson 9y ago> C++ also has static if Not even close. You can't conditionally insert a member.
- bstamour 9y agoHopefully that will be fixed in a future C++ standard. There is an interesting static reflection proposal floating around that would allow for this, plus more.
- xaedes 9y agoThe talk about the reflection proposal was amazing. Meta classes are also very cool. We can only hope it comes fast. https://www.youtube.com/watch?v=4AfRAVcThyA https://www.youtube.com/watch?v=4AfRAVcThyA