Namespaces
Variants

std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: outermost , outermost-construct , outermost-destroy

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)
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 的最外层分配器构造或销毁对象。
给定类型 std:: allocator_traits < std:: remove_reference_t < decltype ( outermost  ( ) ) >> outermost_traits
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 ( ) 是有效的”

参见

[static]
在已分配的存储空间中构造对象
(函数模板)
[static]
销毁存储在已分配存储空间中的对象
(函数模板)