◐ Shell
clean mode source ↗

std::uninitialized_construct_using_allocator - cppreference.com

提供: cppreference.com

<tbody> </tbody>

template< class T, class Alloc, class... Args > constexpr T* uninitialized_construct_using_allocator( T* p, const Alloc& alloc, Args&&... args );

(C++20以上)

p の指す未初期化メモリ位置にアロケータ使用構築の手法によって指定された型 T のオブジェクトを作成します。

以下と同等です。

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 を含みます) を投げる可能性があります。

関連項目