10.8. Constant Expression Parameters
Up to now we have shown you only template classes that instantiate class types. It's also possible to create template classes with constant expression parameters. These parameters help build generic objects and define their operations at compile time. Let's find out how this form of template instantiation works and see an example of its use.
The format for constant expression parameters is a variant of the template class format you've already seen (page 414).
template <class TYPE1, class TYPE2, Type name1, Type nameN> class Class_name { . . . };
Constant expression parameters (Type nameN pairs) are similar to function signature arguments, except that you must instantiate them with expressions that evaluate ...
Get Navigating C++ and Object-Oriented Design 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.