C++ Meta programming madness?

Updated 26th Feb 2024 to fix broken links

I find myself agreeing with Chris on this one. I just dont think I’m clever enough to use these ‘modern’ C++ template programming styles reliably in a way that makes the resulting code better and easier to maintain by others. I’ve tried, but I tend to end up with a confusing mess that I can’t understand when I come back to it. What’s more I often find that I can’t justify the additional complexity of the result compared to doing the work in the ‘old-school’ non template way.

I also think that there may be some truth in Chris’s comment that; Template programming has become a mental game for those who want to be C++ giants. It is a proving ground. C++ templates are not a meta-programming language. Those that use templates for advanced meta programming are abusing a side effect of a language construct. The fact that the syntax is so obtuse (because it was never intended to be used in this way) provides a way to prove mental prowess.

I know one thing. I’m certainly not smart enough to work out how best to use this stuff; I’ll wait for a definitive reference to come along in a few years time and, for the time being, stick to my rule that I don’t want to see that kind of stuff in production systems…