Przejdź do głównej zawartości

C++ named requirements: *Destructible *

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

pubExpressionPost-conditions
pubu.~T()All resources owned by u are reclaimed, no exceptions are thrown

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.

C++ named requirements: *Destructible *

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

pubExpressionPost-conditions
pubu.~T()All resources owned by u are reclaimed, no exceptions are thrown

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.