std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::outermost, outermost-construct, outermost-destroy
来自cppreference.com
< cpp | memory | scoped allocator adaptor
template< class Alloc > /* 未指定 */ /*outermost*/( Alloc&& alloc = *this ); |
(1) | (仅用于阐述*) |
template< class T, class... Args > void /*outermost-construct*/( T* p, Args&&... args ); |
(2) | (仅用于阐述*) |
template< class T > void /*outermost-destroy*/( T* p ); |
(3) | (仅用于阐述*) |
这些仅用于阐述的辅助函数用于成员函数 construct()
和 destroy()
中。
1) 获取 alloc 的最外层分配器。
- 如果表达式 alloc.outer_allocator() 合法,那么就会返回
outermost
(alloc.outer_allocator())。 - 否则就会返回 alloc。
2,3) 使用 *this 的最外层分配器构造或销毁对象。
2) 等价于 outermost_traits::construct(
outermost
(), p, std::forward<Args>(args)...);。3) 等价于 outermost_traits::destroy(
outermost
(), p);。[编辑] 缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 出版时的行为 | 正确行为 |
---|---|---|---|
LWG 3116 | C++11 | outermost 的递归条件是“alloc 拥有成员函数 outer_allocator() ”
|
将条件改为 表达式 alloc.outer_allocator() 合法” |
[编辑] 参阅
[静态] |
在已分配存储中构造对象 (函数模板) |
[静态] |
析构储存于已分配存储中的对象 (函数模板) |