Archive for April, 2020
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 […]
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 […]
Recent Comments