跳到主要内容

std::allocator_arg

定义于内存
自 C++17 起
inline constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
自 C++11 起
struct allocator_arg_t { explicit allocator_arg_t() = default; };

constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t(); // Until C++17

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

缺陷报告

以下改变行为的缺陷报告已追溯应用于先前发布的 C++ 标准。

DR应用于发布时的行为正确行为
LWG 2510C++11默认构造函数不是 explicit 的,这可能导致歧义已声明为 explicit

std::allocator_arg

定义于内存
自 C++17 起
inline constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
自 C++11 起
struct allocator_arg_t { explicit allocator_arg_t() = default; };

constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t(); // Until C++17

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

缺陷报告

以下改变行为的缺陷报告已追溯应用于先前发布的 C++ 标准。

DR应用于发布时的行为正确行为
LWG 2510C++11默认构造函数不是 explicit 的,这可能导致歧义已声明为 explicit