C++ Standard Library C++ STL Library

C++ <memory> - allocator::destroy



The C++ <memory> allocator::destroy member function calls the destructor of the object pointed by p.

  • C++98: Uses value_type's destructor. Calls p->~value_type()
  • C++11: Uses U's destructor. Calls p->~U()

Please note that this does not deallocate the storage for the element (see member deallocate to release storage space).

Syntax

void destroy (pointer p);
template <class U>
  void destroy (U* p);

Parameters

p Pointer to the object being destroyed.

Return Value

None.


❮ C++ <memory> allocator