The std::is_destructible template of C++ STL is present in the <type_traits> header file. The std::is_destructible template of C++ STL is used to check whether the T is destructible or not. A class is called destructible whose destructor is not deleted and potentially accessible in derived classes. It return the boolean value true if T is destructible type, otherwise return false.
template< class T > struct is_destructible;
Parameter: The template std::is_destructible accepts a single parameter T(Trait class) to check whether T is destructible type or not.
Return Value: The template std::is_destructible returns a boolean variable as shown below:
- True: If the type T is a destructible type.
- False: If the type T is not a destructible type.
Below are the programs to demonstrate std::is_destructible in C++:
int is destructible? true float is destructible? true struct X is destructible? true struct Y is destructible? false struct Z is destructible? true struct A is destructible? false
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.