std::allocator_arg, std::allocator_arg_t
来自 cppreference.cn
定义于头文件 <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 构造 (类模板) |