C++ as a programming language is full of
problems but still reasonable. The
metaprogramming part however is really bad.
Exploiting what I think was an unwanted
side-effect of the implementation of C++
templates, after some years people discovered
that the absurdly intricate rules for
overloading resolution and the strange rule
SFINAE ([template] Substitution Failure Is Not
An Error) could be used to make IFs and
recursion-based loops at compile time during
This would have been no problem if many
programmers (not understanding that there is a
difference between what can be done and
what should be done) wouldn't had started
using these unwanted and unanticipated
"features" (basically bugs) to try to write real
This amazingly enough ended up in huge
template-based undebuggable libraries that take
forever to compile, that exhaust at compile time
all existing RAM, that give tens of screenfuls
of error message when you make a typo.
Even more amazingly this absurd way of
programming made it into the standard. Compilers
over the years have been fixed to handle "complex"
(i.e. non completely trivial) templates when in
the early days for example recursion limit was a
problem. C++11 now incorporates some of the
monstruosities that template metaprogramming
obsessed guys designed.
Thanks to this absurd choice of chosing
brainf**k to do metaprogramming it's still too
much to ask for a real loop, data structures or
even just enumerating members of a class at
compile time. Non-trivial metaprogramming in C++
is still impossible (and IMO it's not something
that will be fixed in any foreseeable future).
My choice for metaprogramming in C++ is writing
external code generators in Python. Of course
not an ideal solution as there is no compiler
telling you what it knows and you're forced
instead to work at the text level (a nightmare
thanks to C++ very complex grammar), but still
way better than writing metaprograms in such a
sad and poor environment.