Chapter 12. Template Tools

 

Sticks and stones may occur in nature, but not in the form of levers and fulcrums.

 
 --Henry Petroski
 

I can’t sleep nights till I find out who hurled what ball through what apparatus.

 
 --Dr. Niles Crane, Frasier

Traits

Users of the STL are unlikely to have missed the use of traits, principally char_traits and iterator_traits, in the implementation of the library. A traits class template (also known just as a traits class) defines a protocol for describing a type, and specializations of the traits class describe a specific type. Partial specializations describe a set of types that share common characteristics.

Some traits classes are all about detecting features of types, from which they define their own member values and ...

Get Extended STL, Volume 1: Collections and Iterators 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.