Re:How to abuse a C++ compiler?
by hun-nemethpeter on Thursday March 20, 2014 @10:57AM
(#7435884)
I tried to make a proposal for a more natural meta programming:
https://github.com/hun-nemethpeter/cpp-reflector-mini/blob/m...
D has very good support for this. here's a quick string templating function i wrote, for instance: https://gist.github.com/martindemello/2686640
it calls a function at compile time to expand placeholders, and then compiles the generated string via the mixin() statement and carries on with the code. far more pleasant than c++.
constexpr doesn't really help for logic programming though, which is what this post is using template specialization to do. You can't ask for the answer to Russell's paradox using constexpr (which is, IMHO, a good thing).
constexpr functions where quite restrictive in C++11. They could pretty much only contain a single expression and a return. C++14 significantly relaxes these restrictions.
http://en.wikipedia.org/wiki/C%2B%2B14#Relaxed_constexpr_res...
Type-level meta programming is still confined to using templates though...