10.2. Template Class Definition

Here's the format for template class definitions.

template <class TYPE1, class TYPE2, Type name1, Type nameN> 
class Class_name { . . . };

A template parameter list appears in front of a class definition and consists of the keyword template followed by a comma-separated list of class-type pairs and/or constant expression parameters enclosed by < and >. The class-type pairs (class TYPE1,class TYPE2) follow the same rules as template functions (page 389), but constant expression parameters (Type name1, Type nameN) have a different syntax. With template parameter lists, you may combine class-type pairs and constant expression parameters in any order (or omit them). For now, let's work with the class-type syntax, ...

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.