Namespaces
Variants

C++ named requirements: Destructible

From cppreference.com
 
 
C++ named requirements
 

Specifies that an instance of the type can be destructed.

Requirements

The type T satisfies Destructible if

Given

  • u, an expression of type T.

The following expressions must be valid and have their specified effects.

Expression Post-condition
u.~T() No exception is propagated.

Notes

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.

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DR Applied to Behavior as published Correct behavior
LWG 4317 C++98 u.~T() required all resources owned by u to be
reclaimed, but the definition of “resource” is not provided
removed the
requirement

See also

checks if a type has a non-deleted destructor
(class template) [edit]
checks if reflected type has a non-deleted destructor
(function) [edit]
specifies that an object of the type can be destroyed
(concept) [edit]