Skip to Content
C++ Templates: The Complete Guide, 2nd Edition
book

C++ Templates: The Complete Guide, 2nd Edition

by David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor
September 2017
Intermediate to advanced
822 pages
26h 51m
English
Addison-Wesley Professional
Content preview from C++ Templates: The Complete Guide, 2nd Edition

Appendix E

Concepts

For many years now, C++ language designers have explored how to constrain the parameters of templates. For example, in our prototypical max() template, we’d like to state up front that it shouldn’t be called for types that aren’t comparable using the less-than operator. Other templates may want to require that they be instantiated with types that are valid “iterator” types (for some formal definition of that term) or valid “arithmetic” type (which could be a broader notion than the set of built-in arithmetic types).

A concept is a named set of constraints on one or more template parameters. While C++11 was being a developed, a very rich concept system was designed for it, but integrating the feature into the language specification ...

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

C++ Software Design

C++ Software Design

Klaus Iglberger

Publisher Resources

ISBN: 9780134778808