Namespaces
Variants

std:: allocator_arg, std:: allocator_arg_t

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
定义于头文件 <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 起为内联)
1) std::allocator_arg_t 是一个空类类型,用于消除分配器感知对象(包括 std::tuple std::function std::packaged_task (C++17 前) std::promise )构造函数和成员函数重载的歧义。
2) std::allocator_arg ( 1 ) 的一个实例,可传递给此类允许类型的构造函数和成员函数。

缺陷报告

下列行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。

缺陷报告 应用于 发布时的行为 正确行为
LWG 2510 C++11 默认构造函数为非显式,可能导致歧义 改为显式

参阅

检查指定类型是否支持使用分配器构造
(类模板)