名前空間
変種
操作

std::allocator<T>::construct

提供: cppreference.com
< cpp‎ | memory‎ | allocator
 
 
動的メモリ管理
未初期化記憶域
ガベージコレクションサポート
その他
(C++20)
(C++11)
(C++11)
C のライブラリ
低水準のメモリ管理
 
std::allocator
メンバ関数
(C++20未満)
(C++20未満)
allocator::construct
(C++20未満)
(C++20未満)
非メンバ関数
 
ヘッダ <memory> で定義
void construct( pointer p, const_reference val );
(1) (C++11未満)
template<class U, class... Args>
void construct( U* p, Args&&... args);
(2) (C++11以上)
(C++17で非推奨)
(C++20で削除)

配置 new を使用して、 p の指す確保済みの未初期化記憶域に T 型のオブジェクトを構築します。

1)new((void*)p) T(val) を呼びます。
2)::new((void*)p) U(std::forward<Args>(args)...) を呼びます。

[編集]引数

p - 確保済みのみ初期化記憶域を指すポインタ
val - コピーコンストラクタの引数として使用する値
args... - 使用するコンストラクタ引数

[編集]戻り値

(なし)

[編集]関連項目

[静的]
確保された記憶域にオブジェクトを構築します
(関数テンプレート)[edit]
確保関数
(関数)[edit]
close