Skip to content

Destructible

Specifies that an instance of the type can be destructed.

The type T satisfies Destructible if

Given

  • u, an expression of type T.

  • u, an lvalue expression of type Key.

ExpressionPost-Conditions
u.~T()All resources owned by u are reclaimed, no exceptions are thrown.

Destructors are called implicitly at the end of object lifetime such as when leaving scope or by the delete-expression. Explicit destructor call as shown in the type requirement table is rare.

Thanks to pseudo destructor call, all scalar types meet the requirement of Destructible, while array types and reference types do not. Note that std::is_destructible allows arrays and reference types.

std::is_destructible
(since C++11)
std::is_trivially_destructible
(since C++11)
std::is_nothrow_destructible
(since C++11)

checks if a type has a non-deleted destructor

(class template)
destructible
(since C++20)

specifies that an object of the type can be destroyed

(concept)