Namespaces
Variants

std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: scoped_allocator_adaptor

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)
定义于头文件 <scoped_allocator>
scoped_allocator_adaptor ( ) ;
(1) (C++11 起)
template < class OuterA2 >

scoped_allocator_adaptor (
OuterA2 && outerAlloc, const InnerAllocs & ... innerAllocs

) noexcept ;
(2) (C++11 起)
scoped_allocator_adaptor (

const scoped_allocator_adaptor & other

) noexcept ;
(3) (C++11 起)
scoped_allocator_adaptor (

scoped_allocator_adaptor && other

) noexcept ;
(4) (C++11 起)
template < class OuterA2 >

scoped_allocator_adaptor (
const scoped_allocator_adaptor < OuterA2, InnerAllocs... > & other

) noexcept ;
(5) (C++11 起)
template < class OuterA2 >

scoped_allocator_adaptor (
scoped_allocator_adaptor < OuterA2, InnerAllocs... > && other

) noexcept ;
(6) (C++11 起)
1) 默认构造函数:值初始化 OuterAlloc 基类及内部分配器成员对象(若实现中使用)。
2) std:: forward < OuterA2 > ( outerAlloc ) 构造基类 OuterAlloc ,并使用 innerAllocs... 构造内部分配器。此重载仅当 std:: is_constructible < OuterAlloc, OuterA2 > :: value true 时参与重载决议。
3) 复制构造函数:从 other 的对应分配器初始化每个分配器。
4) 移动构造函数:将每个分配器从 other 的对应分配器移动至 * this
5) other 对应的分配器初始化每个分配器。此重载仅当 std:: is_constructible < OuterAlloc, const OuterA2 & > :: value true 时参与重载决议。
6) 使用移动语义从 other 的对应分配器初始化每个分配器。仅当 std:: is_constructible < OuterAlloc, OuterA2 > :: value true 时,此重载才参与重载决议。

参数

outerAlloc - 外部分配器的构造函数参数
innerAllocs... - 内部分配器的构造函数参数
other - 另一个 std::scoped_allocator_adaptor

缺陷报告

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

缺陷报告 应用于 发布时的行为 正确行为
LWG 2782 C++11 接受 OuterA2 的构造函数未受约束,干扰元编程 已添加约束条件

参见

使用外层分配器分配未初始化的存储空间
(公开成员函数)
在已分配的存储空间中构造对象,若适用则向其构造函数传递内层分配器
(公开成员函数)