Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/named req/Destructible"

From cppreference.com
< cpp‎ | named req
m (T. Canens moved page cpp/concept/Destructible to cpp/named req/Destructible without leaving a redirect: Text replace - "cpp/concept" to "cpp/named req")
(named req/core)
Line 6: Line 6:
 
===Requirements===
 
===Requirements===
  
The type {{tt|T}} satisfies {{tt|Destructible}} if
+
The type {{tt|T}} satisfies {{named req/core|Destructible}} if
  
 
Given
 
Given
Line 24: Line 24:
 
Destructors are called implicitly at the end of [[cpp/language/lifetime|object lifetime]] such as when leaving [[cpp/language/scope|scope]] or by the [[cpp/language/delete|delete-expression]]. Explicit destructor call as shown in the type requirement table is rare.
 
Destructors are called implicitly at the end of [[cpp/language/lifetime|object lifetime]] such as when leaving [[cpp/language/scope|scope]] or by the [[cpp/language/delete|delete-expression]]. Explicit destructor call as shown in the type requirement table is rare.
  
Thanks to [[cpp/language/operator_member_access#Built-in_member_access_operators|pseudo destructor call]], all scalar types meet the requirement of {{ttb|Destructible}}, while array types and reference types do not. Note that {{lc|std::is_destructible}} allows arrays and reference types.
+
Thanks to [[cpp/language/operator_member_access#Built-in_member_access_operators|pseudo destructor call]], all scalar types meet the requirement of {{named req/core|Destructible}}, while array types and reference types do not. Note that {{lc|std::is_destructible}} allows arrays and reference types.
  
 
===See also===
 
===See also===
Line 31: Line 31:
 
{{dsc end}}
 
{{dsc end}}
  
[[de:cpp/named req/Destructible]]
+
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}
[[es:cpp/named req/Destructible]]
+
[[fr:cpp/named req/Destructible]]
+
[[it:cpp/named req/Destructible]]
+
[[ja:cpp/named req/Destructible]]
+
[[pt:cpp/named req/Destructible]]
+
[[ru:cpp/named req/Destructible]]
+
[[zh:cpp/named req/Destructible]]
+

Revision as of 00:45, 17 June 2018

 
 
C++ named requirements
 

Specifies that an instance of the type can be destructed.

Requirements

The type T satisfies Destructible if

Given

  • u, a expression of type T

The following expressions must be valid and have their specified effects

Expression Post-conditions
u.~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.

See also

checks if a type has a non-deleted destructor
(class template) [edit]