◐ Shell
clean mode source ↗

std::make_obj_using_allocator - cppreference.com

来自cppreference.com

template< class T, class Alloc, class... Args >
constexpr T make_obj_using_allocator( const Alloc& alloc, Args&&... args );
(C++20 起)

使用分配器构造的手段创建给定的 T 类型对象。

等价于

return std::make_from_tuple<T>(
    std::uses_allocator_construction_args<T>(alloc, std::forward<Args>(args)...)
);

参数

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

返回值

新创建的 T 类型对象。

异常

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

示例

参阅