std::scoped_allocator_adaptor::scoped_allocator_adaptor

定义于头文件 <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++ 标准。

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

参阅

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

版本历史

  • (当前 | 先前 2017年6月4日 (日) 20:00Fruderica讨论 | 贡献. . (2,422字节) (-851). . (撤销)
  • 当前 | 先前 2013年7月2日 (二) 09:06P12bot讨论 | 贡献 . . (3,273字节) (-264). . (Use {{lc}}. Update links. Various fixes.) (撤销)
  • 当前 | 先前 2012年11月2日 (五) 15:19P12bot讨论 | 贡献 . . (3,537字节) (+545). . (r2.7.3) (机器人添加:de, en, es, fr, it, ja, pt, ru) (撤销)
  • 当前 | 先前 2012年10月27日 (六) 03:40P12讨论 | 贡献 . . (2,992字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前 2012年10月26日 (五) 06:00TranslationBot讨论 | 贡献. . (2,992字节) (-63). . (Translated from the English version using Google Translate) (撤销)
  • 当前 | 先前 2012年10月25日 (四) 14:54P12讨论 | 贡献 . . (3,055字节) (0). . (1个修订: Translate from the English version) (撤销)
  • 当前 | 先前) 2012年10月25日 (四) 12:00TranslationBot讨论 | 贡献. . (3,055字节) (+3,055). . (Translated from the English version using Google Translate)