名稱空間
變體
操作

std::make_obj_using_allocator

來自 cppreference.com
< cpp‎ | 記憶體
 
 
記憶體管理庫
(僅作說明*)
未初始化記憶體演算法
(C++17)
(C++17)
(C++17)
受約束的未初始化
記憶體演算法
C 庫

分配器
make_obj_using_allocator
(C++20)
記憶體資源
垃圾回收支援
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
(C++11)(直到 C++23)
未初始化儲存
(直到 C++20*)
(直到 C++20*)
顯式生命週期管理
 
定義於標頭檔案 <memory>
template< class T, class Alloc, class... Args >
constexpr T make_obj_using_allocator( const Alloc& alloc, Args&&... args );
(C++20 起)

透過使用分配器構造來建立給定型別T的物件。

等價於

目錄

[編輯] 引數

alloc - 要使用的分配器
args - 傳遞給T的建構函式的引數

[編輯] 返回值

新建立的型別T的物件。

[編輯] 異常

可能會丟擲T的建構函式丟擲的任何異常,通常包括std::bad_alloc

[編輯] 示例

[編輯] 參閱

準備與給定型別所需的使用分配器構造方式匹配的引數列表
(函式模板) [編輯]
透過使用分配器構造在指定記憶體位置建立給定型別的物件
(函式模板) [編輯]