Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | named req
m (Text replace - "cpp/concept" to "cpp/named req")
m (Text replace - "{{concept" to "{{named req")
Line 2: Line 2:
 
{{cpp/named req/navbar}}
 
{{cpp/named req/navbar}}
  
Specifies that an object of the type can be destroyed by a given {{concept|Allocator}}.
+
Specifies that an object of the type can be destroyed by a given {{named req|Allocator}}.
  
 
===Requirements===
 
===Requirements===
  
The type {{ttb|T}} is {{concept|Erasable}} from the {{concept|Container}} {{ttb|X}} whose {{tt|value_type}} is identical to {{tt|T}} if, given
+
The type {{ttb|T}} is {{named req|Erasable}} from the {{named req|Container}} {{ttb|X}} whose {{tt|value_type}} is identical to {{tt|T}} if, given
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc | {{ttb|A}} | an allocator type}}
 
{{dsc | {{ttb|A}} | an allocator type}}
Line 30: Line 30:
 
===See Also===
 
===See Also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc | {{concept|CopyInsertable}} }}
+
{{dsc | {{named req|CopyInsertable}} }}
{{dsc | {{concept|MoveInsertable}} }}
+
{{dsc | {{named req|MoveInsertable}} }}
{{dsc | {{concept|EmplaceConstructible}} }}
+
{{dsc | {{named req|EmplaceConstructible}} }}
{{dsc | {{concept|Destructible}} }}
+
{{dsc | {{named req|Destructible}} }}
 
{{dsc end}}
 
{{dsc end}}
  
 
{{langlinks|zh}}
 
{{langlinks|zh}}

Revision as of 14:37, 15 June 2018

 
 
C++ named requirements
 

Specifies that an object of the type can be destroyed by a given Allocator.

Requirements

The type T is Erasable from the Container X whose value_type is identical to T if, given

A an allocator type
m an lvalue of type A
p the pointer of type T* prepared by the container

where X::allocator_type is identical to std::allocator_traits<A>::rebind_alloc<T>,

the following expression is well-formed:

std::allocator_traits<A>::destroy(m, p);

If X is not allocator-aware, the term is defined as if A were std::allocator<T>, except that no allocator object needs to be created, and user-defined specializations of std::allocator are not instantiated.

Notes

All standard library containers require that their element type satisfies Erasable.

With the default allocator, this requirement is equivalent to the validity of p->~T(), which accepts class types with accessible destructors and all scalar types, but rejects array types, function types, reference types, and void.

See Also

CopyInsertable
MoveInsertable
EmplaceConstructible
Destructible