◐ Shell
clean mode source ↗

std::allocator_arg, std::allocator_arg_t - cppreference.com

来自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 起)
(inline since C++17)

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

参阅