Exploring the Standard Type Traits: Part 1
Explore the standard C++ type traits that allow you to query type categories, properties, supported operations, and relationships at compile-time. Understand how variable templates simplify trait usage and how traits like is_trivial and is_same help you write flexible and type-safe code.
We'll cover the following...
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 (license usage link). ...