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> の公開メンバ関数)