Archive for March, 2020

std::is_empty

Written by on March 28, 2020 in C++, Programming with 0 Comments
std::is_empty<T>

In the previous post, we looked at the std::is_destructible<T> type trait. Today, let us try to understand another type trait std::is_empty<T>. As per the specification, is_empty<T>::value will return true in the following cases: – The class/struct has no non-static data member – The class/struct does not define a virtual function – The class/struct does not […]

Continue Reading

std::is_destructible

Written by on March 15, 2020 in C++, Programming with 0 Comments
std::is_destructible

In the last article, I explained the deleted destructor in some detail. Today, I would like to talk about a related construct, a type trait called std::is_destructible. Type traits, defined in the header <type_traits>, are a big help when it comes to implementing template metaprogramming.  See this article for a nice introduction to type traits in […]

Continue Reading

Deleted Destructor in C++

Written by on March 4, 2020 in C++ with 0 Comments
Deleted Destructor in C++

Since C++ 11, we can use the keyword delete to declare functions as deleted and thus prohibit the use of these functions in the code. See this article for a brief overview. In particular, the destructor of a class/struct/union can be declared as deleted. In today’s article, I am going to discuss this specific feature in […]

Continue Reading

Top