名稱空間
變體
操作

std::allocator_arg, std::allocator_arg_t

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

分配器
allocator_arg
(C++11)
記憶體資源
垃圾回收支援
(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>
struct allocator_arg_t { explicit allocator_arg_t() = default; };
(1) (C++11 起)
constexpr std::allocator_arg_t allocator_arg {};
(2) (C++11 起)
(C++17 起為 inline)
1) std::allocator_arg_t 是一個空類型別,用於消除分配器感知物件(包括 std::tuplestd::functionstd::packaged_task(C++17 前)std::promise)的建構函式和成員函式的過載歧義。
2) std::allocator_arg(1) 的一個例項,可以傳遞給此類允許型別的建構函式和成員函式。

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 2510 C++11 預設建構函式不是 explicit 的,可能導致歧義 改為 explicit

[編輯] 參見

檢查指定型別是否支援 uses-allocator 構造
(類模板) [編輯]