Archive for May, 2020

std::is_convertible<>

Written by on May 24, 2020 in C++, Programming with 0 Comments
std::is_convertible<>

The type trait is_convertible<From, To> checks if an object of type From can be “implicitly” converted to an object of type To. The expression is_convertible<From, To>::value returns true if implicit conversion is possible, else it returns false. For more details, please check out the reference. Let us look at three primary cases. Case-1: Pre-defined Types […]

Continue Reading

dynamic_cast<> vs. std::is_base_of<>

Written by on May 9, 2020 in C++, Programming with 0 Comments
dynamic_cast<> vs. std::is_base_of<>

In the last article, we looked at the std:is_base_of<T1, T2> type trait. One question that a reader asked since that article appeared is “How does is_base_of<> differ from the dynamic_cast<> operator?” Good question! In today’s post let me try to address the key differences between the two. I am not going to cover the dynamic_cast<> […]

Continue Reading

Top