|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Defined in header <memory> | ||
template<class T> staticvoid destroy( Alloc& a, T* p); | (since C++11) (constexpr since C++20) | |
Calls the destructor of the object pointed to byp. If possible, does so by callinga.destroy(p). If not possible (e.g.Alloc does not have the member functiondestroy()), then callsthe destructor of*p directly, asp->~T()(until C++20)std::destroy_at(p)(since C++20).
Contents |
| a | - | allocator to use for destruction |
| p | - | pointer to the object being destroyed |
(none)
Because this function provides the automatic fall back to direct call to the destructor, the member functiondestroy() is an optionalAllocator requirement since C++11.
| This section is incomplete Reason: no example |
(until C++20) | destructs an object in allocated storage (public member function of std::allocator<T>)[edit] |