Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | named req
m (D41D8CD98F moved page cpp/concept/Eraseable to cpp/concept/Erasable)
(LWG2218. No {{rev inl}} - "previous standardese was nonsense" (STL), ")
Line 6: Line 6:
 
===Requirements===
 
===Requirements===
  
The type {{ttb|T}} is {{concept|Erasable}} from the {{concept|Container}} {{ttb|X}} if, given
+
The type {{ttb|T}} is {{concept|Erasable}} from the {{concept|Container}} {{ttb|X}} whose {{tt|value_type}} is identical to {{tt|T}} if, given
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc | {{ttb|A}} | the allocator type defined as {{ttb|X::allocator_type}} }}
+
{{dsc | {{ttb|A}} | an allocator type}}
{{dsc | {{ttb|m}} | the lvalue of type {{ttb|A}} obtained from {{c|X::get_allocator()}} }}
+
{{dsc | {{ttb|m}} | an lvalue of type {{ttb|A}} }}
 
{{dsc | {{ttb|p}} | the pointer of type {{ttb|T*}} prepared by the container }}
 
{{dsc | {{ttb|p}} | the pointer of type {{ttb|T*}} prepared by the container }}
 
{{dsc end}}
 
{{dsc end}}
 +
 +
where {{ttb|X::allocator_type}} is identical to {{c|std::allocator_traits<A>::rebind_alloc<T>}},
  
 
the following expression is well-formed:
 
the following expression is well-formed:
Line 18: Line 20:
 
std::allocator_traits<A>::destroy(m, p);
 
std::allocator_traits<A>::destroy(m, p);
 
}}
 
}}
 +
 +
If {{ttb|X}} is not allocator-aware, the term is defined as if {{ttb|A}} were {{c|std::allocator<T>}}, except that no allocator object needs to be created, and user-defined specializations of {{lc|std::allocator}} are not instantiated.
  
 
===See Also===
 
===See Also===

Revision as of 16:15, 20 November 2015

Template:cpp/concept/title Template:cpp/concept/navbar

Specifies that an object of the type can be destroyed by a given Template:concept.

Requirements

The type T is Template:concept from the Template:concept 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.

See Also

Template:concept
Template:concept
Template:concept
Template:concept