std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::outermost, outermost-construct, outermost-destroy
来自 cppreference.cn
< cpp | memory | scoped allocator adaptor
template< class Alloc > /* unspecified */ /*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++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 3116 | C++11 | outermost 的递归条件是 “alloc具有成员函数 outer_allocator() ” |
更改为 “表达式 alloc.outer_allocator() 有效” |
[编辑] 参见
[静态] |
在已分配的存储中构造对象 (函数模板) |
[静态] |
析构存储在已分配存储中的对象 (函数模板) |