std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>::outermost, outermost-construct, outermost-destroy
來自 cppreference.com
< 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);。[edit] 缺陷報告
下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。
缺陷報告 | 應用於 | 釋出時的行為 | 正確的行為 |
---|---|---|---|
LWG 3116 | C++11 | outermost 的遞迴條件是 “alloc具有成員函式 outer_allocator() ” |
更改為 “表示式 alloc.outer_allocator() 有效” |
[edit] 參閱
[靜態] |
在已分配的儲存中構造一個物件 (函式模板) |
[靜態] |
銷燬儲存在已分配儲存中的物件 (函式模板) |