Skip to Content
Navigating C++ and Object-Oriented Design
book

Navigating C++ and Object-Oriented Design

by Paul Anderson, Gail Anderson
October 1997
Intermediate to advanced
800 pages
20h 48m
English
Pearson
Content preview from Navigating C++ and Object-Oriented Design

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Exploring C++20: The Programmer's Introduction to C++

Exploring C++20: The Programmer's Introduction to C++

Ray Lischner

Publisher Resources

ISBN: 0135327482Purchase book