Type Comparisons and Modifications
Sometimes we need to manipulate or compare different types. We can use the type traits library for that!
We'll cover the following...
Type Comparisons
The library supports three kinds of type comparisons:
Function | Description |
---|---|
template <class Base, class Derived> |
Checks if Derived is derived from Base . |
struct is_base_of |
|
template <class From, class To> |
Checks if From can be converted to To . |
struct is_convertible |
|
template <class T, class U> |
Checks if the types T and U are the same. |
Access this course and 1400+ top-rated courses and projects.