Skip to main content

std::allocator<T>::destroy

Defined in header <memory>

Until C++11
// 1)
void destroy( pointer p );
Since C++11, Deprecated in C++17, Removed in C++20
// 2)
template< class U >
void destroy( U* p );

Calls the destructor of the object pointed to by p.

Calls p->~T().
2) Calls p->~U().

Parameters

p - pointer to the object that is going to be destroyed

Return value

(none)

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DRApplied toBehavior as publishedCorrect behavior
LWG 400C++98p was casted to T*, which is the type of premoved the redundant cast

std::allocator<T>::destroy

Defined in header <memory>

Until C++11
// 1)
void destroy( pointer p );
Since C++11, Deprecated in C++17, Removed in C++20
// 2)
template< class U >
void destroy( U* p );

Calls the destructor of the object pointed to by p.

Calls p->~T().
2) Calls p->~U().

Parameters

p - pointer to the object that is going to be destroyed

Return value

(none)

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DRApplied toBehavior as publishedCorrect behavior
LWG 400C++98p was casted to T*, which is the type of premoved the redundant cast