Namespaces
Variants

std:: uninitialized_construct_using_allocator

From cppreference.net
Memory management library
( exposition only* )
Allocators
uninitialized_construct_using_allocator
(C++20)
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, class Alloc, class ... Args >

constexpr T * uninitialized_construct_using_allocator ( T * p,
const Alloc & alloc,

Args && ... args ) ;
(C++20以降)

指定された型 T のオブジェクトを、 uses-allocator構築 によって、 p で示される未初期化メモリ位置に作成します。

次と同等

return std::apply(
    [&]<class... Xs>(Xs&&...xs)
    {
        return std::construct_at(p, std::forward<Xs>(xs)...);
    },
    std::uses_allocator_construction_args<T>(alloc, std::forward<Args>(args)...));

目次

パラメータ

p - オブジェクトが配置されるメモリ位置
alloc - 使用するアロケータ
args - Tのコンストラクタに渡す引数

戻り値

T の新しく作成されたオブジェクトへのポインタ。

例外

T のコンストラクタが送出するあらゆる例外を送出する可能性があります。一般的には std::bad_alloc を含みます。

関連項目

指定された型がuses-allocator構築をサポートするかどうかをチェックする
(クラステンプレート)
uses-allocator構築によって指定された型のオブジェクトを作成する
(関数テンプレート)