O'Reilly logo

Extended STL, Volume 1: Collections and Iterators by Matthew Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required