...

/

Exploring the Standard Type Traits: Part 1

Exploring the Standard Type Traits: Part 1

Take your knowledge of templates to the next level by understanding the standard type traits.

The standard library features a series of type traits for querying properties of types as well as performing transformations on types. These type traits are available in the <type_traits> header as part of the type support library. There are several categories of type traits, including the following:

  • Querying the type category (primary or composite)

  • Querying type properties

  • Querying supported operations

  • Querying type relationships

  • Modifying cv-specifiers, references, pointers, or a sign

  • Miscellaneous transformations

Although looking at every single type trait is beyond the scope of this course, we’ll explore all these categories to see what they contain. In this lesson, we’ll list the type traits (or most of them) that make up each of these categories. These lists as well as detailed information about each type trait can be found in the C++ standard (see Further Readings lesson at the end of the course for a link to a freely available draft version) or on the cppreference website ( ...