Difference between revisions of "cpp/named req/Erasable"
(LWG2218. No {{rev inl}} - "previous standardese was nonsense" (STL), ") |
(note why this is important (container requirement) and that arrays are not acceptable.) |
||
Line 22: | Line 22: | ||
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. | 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. | ||
+ | |||
+ | ===Notes=== | ||
+ | All [[cpp/container|standard library containers]] require that their element type satisfies Eraseable. | ||
+ | |||
+ | With the default allocator, this requirement is equivalent to the validity of {{c|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=== | ===See Also=== |
Revision as of 14:26, 29 December 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.
Notes
All standard library containers require that their element type satisfies Eraseable.
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
Template:concept | |
Template:concept | |
Template:concept | |
Template:concept |