logoalt Hacker News

pjmlp04/23/20251 replyview on HN

Not at all, originally template metaprogramming was discovered by accident.

Cannot recall any longer if the original article on the matter appeared on The C/C++ Users Journal or Dr. Dobbs.

Eventually it started to get abused and the Turing completeness has been discovered.

Since C++11, the approach to a more sane way to do metaprogramming with templates has been improving.

Instead of tag dispatch, ADL and SFINAE, we can make use of concepts, if constexpr/eval/init, type traits, and eventually reflection, instead of the old clunky ways.


Replies

troutwine04/24/2025

“C++ Templates are Turing Complete” by Todd L. Veldhuizen has the history of discovery, early elaboration.

show 1 reply