Namespaces
Variants
Views
Actions

std::destroy_at

From cppreference.com
< cpp‎ | memory
Revision as of 00:27, 4 May 2017 by Fruderica (Talk | contribs)

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
Dynamic memory management
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Allocators
Garbage collection support
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)



 
Defined in header <memory>
template< class T >
void destroy_at( T* p );
(since C++17)

Calls the destructor of the object pointed to by p, as if by p->~T().

Contents

Parameters

p - a pointer to the object to be destroyed

Return value

(none)

Possible implementation

template<class T>
void destroy_at(T* p) 
{ 
    p->~T(); 
}

Example

See also

(C++17)
destroys a range of objects
(function template) [edit]
(C++17)
destroys a number of objects in a range
(function template) [edit]