C++ Standard Library C++ STL Library

C++ <memory> - allocator_traits::destroy



The C++ <memory> allocator_traits::destroy member 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().

Syntax

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

Parameters

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

Return Value

None.


❮ C++ <memory> allocator_traits