X Tutup
The Wayback Machine - https://web.archive.org/web/20240323221837/https://zh.cppreference.com/w/cpp/memory/allocator_arg

std::allocator_arg

来自cppreference.com
< cpp‎ | memory
 
 
工具库
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)(C++20)(C++20)
(C++20)
swap 与类型运算
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
常用词汇类型
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
初等字符串转换
(C++17)
(C++17)
 
动态内存管理
未初始化内存算法
受约束的未初始化内存算法
分配器
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 前)



 
在标头 <memory> 定义
struct allocator_arg_t { explicit allocator_arg_t() = default; };
(C++11 起)
constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
(C++11 起)
(C++17 前)
inline constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
(C++17 起)

std::allocator_arg_t 是一个空类类型,用于对具分配器对象的构造函数和成员函数的重载消解歧义,它们包括 std::tuplestd::functionstd::packaged_task (C++17 前)std::promisestd::allocator_arg 是它的一个常量。

[编辑] 缺陷报告

下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告 应用于 出版时的行为 正确行为
LWG 2510 C++11 默认构造非 explicit,可能导致歧义 使之explicit

[编辑] 参阅

检查指定的类型是否支持使用分配器的构造
(类模板) [编辑]
X Tutup