Exploring the Standard Type Traits: Part 2
Understand type transformation using metafunctions in C++ template metaprogramming.
We'll cover the following...
Modifying cv-specifiers, references, pointers, or a sign
The type traits that are performing transformations on types are also called metafunctions. These type traits provided a member type (typedef
) called type
that represents the transformed type. This category of type traits includes the following:
Type Traits for Certain Transformations
Name | Description |
| Add the |
| Remove the |
| Add an Ivalue or value reference to a type. |
| Removes a reference (either value or rvalue) from a type. |
| Removes the |
| Adds a pointer to a type. |
| Removes a pointer from a type. |
| Make an integral type (except for |
| Remove one or all extents from an array type. |
With the exception of remove_cvref
, which was added in C++20, all the other type traits listed in this table are available in C++11. These aren’t all the metafunctions from the standard library. More are listed next.
Miscellaneous transformations
Apart from the metafunctions previously listed, there are other type traits performing type transformations. The ...