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

来自cppreference.com
 
 
内存管理库
(仅用于阐述*)
分配器
未初始化内存算法
受约束的未初始化内存算法
内存资源
未初始化存储 (C++20 前)
(C++17 弃用)
(C++17 弃用)
垃圾收集器支持 (C++23 前)
(C++11)(C++23 前)
(C++11)(C++23 前)
(C++11)(C++23 前)
(C++11)(C++23 前)
(C++11)(C++23 前)
(C++11)(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>::valuetrue 时才会参与重载决议。
3) 复制构造函数:从 other 的对应分配器初始化每个分配器。
4) 移动构造函数:从 other 的对应分配器移动每个分配器到 *this 内。
5)other 的对应分配器初始化每个分配器。此重载只有在 std::is_constructible<OuterAlloc, const OuterA2&>::valuetrue 时才会参与重载决议。
6) 用移动语义,从 other 的对应分配器初始化每个分配器。此重载只有在 std::is_constructible<OuterAlloc, OuterA2>::valuetrue 时才会参与重载决议。

参数

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

缺陷报告

下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。

缺陷报告应用于出版时的行为正确行为
LWG 2782C++11接收 OuterA2 的构造函数未受约束,干扰到元编程添加了约束

参阅

用外层分配器分配未初始化存储
(公开成员函数)
在分配的存储上构造一个对象,若适合则传递内存分配器至其构造函数
(公开成员函数)