Namespaces
Variants

std::allocator_traits<Alloc>:: destroy

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (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)
(C++11) (until C++23)
헤더 파일에 정의됨 <memory>
template < class T >
static void destroy ( Alloc & a, T * p ) ;
(C++11부터)
(C++20부터 constexpr)

p 가 가리키는 객체의 소멸자를 호출합니다. 가능한 경우 a. destroy ( p ) 를 호출하여 수행합니다. 가능하지 않은 경우(예: Alloc destroy() 멤버 함수를 갖지 않는 경우), 다음을 호출합니다: * p 의 소멸자를 직접 호출하며, p - > ~T ( ) 형태로 (C++20 이전) std:: destroy_at ( p ) (C++20 이후) .

목차

매개변수

a - 소멸에 사용할 할당자
p - 소멸되는 객체에 대한 포인터

반환값

(없음)

참고 사항

이 함수는 소멸자에 대한 직접 호출로 자동으로 대체되므로, 멤버 함수 destroy() 는 C++11부터 선택적인 Allocator 요구 사항입니다.

예제

참고 항목

(until C++20)
할당된 저장 공간의 객체를 파괴함
( std::allocator<T> 의 public 멤버 함수)