|
|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Specifies that an instance of the type can be destructed.
The typeT satisfiesDestructible if
Given
u, an expression of typeT.The following expressions must be valid and have their specified effects.
| Expression | Post-conditions |
|---|---|
| u.~T() | All resources owned byu are reclaimed, no exceptions are thrown. |
Destructors are called implicitly at the end ofobject lifetime such as when leavingscope or by thedelete-expression. Explicit destructor call as shown in the type requirement table is rare.
Thanks topseudo destructor call, all scalar types meet the requirement ofDestructible, while array types and reference types do not. Note thatstd::is_destructible allows arrays and reference types.
(C++11)(C++11)(C++11) | checks if a type has a non-deleted destructor (class template)[edit] |
(C++20) | specifies that an object of the type can be destroyed (concept)[edit] |