Namespaces
Variants

std:: make_obj_using_allocator

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)
td> (C++20 起)
定义于头文件 <memory>
template < class T, class Alloc, class ... Args >
constexpr T make_obj_using_allocator ( const Alloc & alloc, Args && ... args ) ;

通过 使用分配器构造 方式创建给定类型 T 的对象。

等同于

目录

参数

alloc - 要使用的分配器
args - 传递给 T 构造函数的参数

返回值

新创建的 T 类型对象。

异常

可能抛出 T 的构造函数所抛出的任何异常,通常包括 std::bad_alloc

示例

参见

准备与给定类型所需的使用分配器构造风格匹配的参数列表
(函数模板)
通过使用分配器构造方式在指定内存位置创建给定类型的对象
(函数模板)