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 construction 을 통해 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 construction을 지원하는지 확인합니다
(클래스 템플릿)
uses-allocator construction 방식을 통해 주어진 타입의 객체를 생성합니다
(함수 템플릿)