std::allocator_arg, std::allocator_arg_t
來自 cppreference.com
定義於標頭檔案 <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::tuple、std::function、std::packaged_task(C++17 前) 和 std::promise)的建構函式和成員函式的過載歧義。[編輯] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 2510 | C++11 | 預設建構函式不是 explicit 的,可能導致歧義 | 改為 explicit |
[編輯] 參見
(C++11) |
檢查指定型別是否支援 uses-allocator 構造 (類模板) |