I’m having difficulty understanding the syntax of C++ Template Template parameters. I understand why they are useful, as per the excellent description here, I just find their syntax hard to get to understand. Two examples taken from the above website (there are others):
template <typename T, template <typename> class Cont>
class Stack;
and
template <template <typename,typename> class Cont>
class Wrapper3;
Clearly generalizing such declarations is impossible without some understanding of the rationale behind this syntax. Memorizing is harder and does not seem to be of much help.
Edit:
I realize that my attempt at a question came across like an observation. What I’m asking for is help on how to interprete the Template Template parameter syntax in everyday speak. I can do this with the C++ syntax and the all the other programming languages that I’ve learned. However I’m having difficulty “explaining” the syntax of C++ Template Template parameters to myself. I’ve gotten a book, “C++ templates : the complete guide” by David Vandevoorde and Nicolai M. Josuttis, and while its a nice book, it hasn’t been of much help to me in understanding this syntax which I’m sure many will agree is at best quirky.
There’s nothing so arcane about it. Just take out your template template parameters from the original template:
Any class template with a single type argument fits, such as
And you would use your original template as