Search⌘ K

Type Comparisons and Modifications

Explore the fundamental concepts of type comparisons and modifications in C++17. Understand how to use type traits such as is_base_of, is_convertible, and is_same for compile-time checks. Learn to modify types with add_const and remove_const, and utilize advanced utilities like enable_if and conditional to write flexible and optimized generic code.

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.
struct
...