When doing template metaprogramming, you may often find yourself in situations where you need information about the types you are dealing with at compile time. Since the result of metaprogramming is the generated C++ code, the generated C++ code needs to be correct. This is, of course, never the case for traditional functions, as they only deal with specified types.
There are two categories of type traits:
- Type traits that return information about a type as a boolean or an integer value
- Type traits that return a new type
The first category returns true or false depending on the input and ends with _v (short for value).
The _v postfix has been added in C++17. If your STL implementation does...