upvote
> The template metaprogramming C++ offers is the most powerful of any imperative language

I'm curious what languages you're comparing to here. Feels like it's only slightly more expressive than pure generics, but I admittedly haven't done much template metaprogramming myself. How does it compare to, say, Zig's comptime?

reply
The problem with metaprogramming-heavy C++ codebases is always compilation times and obtuse error messages...

Template metaprogramming is sometimes very useful to get around C++'s language restrictions, but I tend to use it sparingly.

reply
> obtuse error messages

With concepts and constexpr-if and consteval it's increasingly less of a problem

reply
have you written about this anywhere, or hosting any examples?
reply
You might find Functional Programming in C++ by Ivan Cukic relevant.
reply
Not yet, I might one day.
reply
C++ template metaprogramming is in some ways more powerful than Common Lisp macros, because it works at the type level: you can generate new types and dispatch into separate implementations by type. In contrast, Common Lisp type declarations are not available at macro expansion time unless you implement a full source-to-source translator in macros.
reply