Template Classes with Several Parameters
In previous examples, I used a template class with one type parameter only, even though I mentioned that a template class can have several type parameters.
These parameters can be type parameters similar to the previous examples or even parameters that resemble conventional value parameters in functions. Multiple parameters and the mix of type parameters and expression parameters notably increase the flexibility of C++ templates. At the same time, they introduce additional syntactic complexities.
Several Type Parameters
Let us consider a template class with more than one type parameter. The names of these parameters should be used within the class for its data members, local variables, or method parameters. ...
Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.