C++ Standard Library C++ STL Library

C++ <memory> - allocator_traits destroy() Function

The C++ <memory> allocator_traits::destroy function destroys the element object pointed by p without deallocating its storage.

If possible, it does so by calling alloc.destroy(p). If not possible (e.g. Alloc does not have the member function destroy()), then it calls the destructor of *p directly, as p->~T().


template <class T>
  static void destroy (allocator_type& alloc, T* p);


alloc Allocator to use for destruction.
p Pointer to the object being destroyed.

Return Value


❮ C++ <memory> Library