Archive for April, 2020

std::is_base_of<>

Written by on April 26, 2020 in C++, Programming with 0 Comments
std::is_base_of<>

In our on-going series on C++ Type Traits, today’s topic is about the trait std::is_base_of<>. For the official description, see this. std::is_base_of<A, B>::value takes two arguments, both classes (or structs), and returns true if A is a base class of B and false otherwise. Trivially, std::<A, A>::value is true. Let us look at an example […]

Continue Reading

std::common_type<> Type Trait

Written by on April 12, 2020 in C++, Programming with 0 Comments
std::common_type<> Type Trait

In today’s post, I would like to go over the type trait std::common_type<>. This trait was introduced in C++11. As per the specification, std::common_type<T1, T2, …Tn>::type refers to a type Tx in the given list, which the rest of the types in the list can be implicitly converted to. This works with built-in as well […]

Continue Reading

Top