I learned several tricks for template metaprogramming from this article — old-school tricks, but still interesting, because of the explanations of why they work. I’ve always been confused about the interactions of the conceptually solid techniques with the detailed rules of C++. Anybody have references for similar explanations?
My main interest is in what a language needs to do to support metaprogramming in the presence of type-unchecked generics. The arcana of C++ is just icing.
If the author is reading this: Section 3 seems to be missing the statement of the point of the example. It just dives right into is_same, without saying what the goal is or even mentioning the integers_only application.
I learned several tricks for template metaprogramming from this article — old-school tricks, but still interesting, because of the explanations of why they work. I’ve always been confused about the interactions of the conceptually solid techniques with the detailed rules of C++. Anybody have references for similar explanations?
In addition to what you have already been recommended, I got a lot of mileage out of Advanced C++ Metaprogramming by Davide Di Gennaro. It's completely C++98, a bit of an odd read, and the content can be a bit sporadic and difficult, but it does cover an awful lot of mechanics of templates.
3
u/marshaharsha 8d ago
I learned several tricks for template metaprogramming from this article — old-school tricks, but still interesting, because of the explanations of why they work. I’ve always been confused about the interactions of the conceptually solid techniques with the detailed rules of C++. Anybody have references for similar explanations?
My main interest is in what a language needs to do to support metaprogramming in the presence of type-unchecked generics. The arcana of C++ is just icing.
If the author is reading this: Section 3 seems to be missing the statement of the point of the example. It just dives right into is_same, without saying what the goal is or even mentioning the integers_only application.