Namespaces
Variants

std:: allocation_result

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)
ヘッダーで定義 <memory>
template < class Pointer, class SizeType = std:: size_t >
struct allocation_result ;
(C++23以降)

allocation_result 特殊化は、適切な Allocator 型(例: std::allocator::allocate_at_least および std::allocator_traits::allocate_at_least )の allocate_at_least メンバ関数から返されます。

allocation_result のすべての特殊化は、 ptr count 以外の基底クラスや宣言されたメンバーを持たないため、 aggregate initialization structured binding に適しています。

目次

テンプレートパラメータ

Pointer - 一般的に std:: allocator_traits < Alloc > :: pointer 、ここで Alloc Allocator
SizeType - 一般的に std:: allocator_traits < Alloc > :: size_type 、ここで Alloc Allocator

データメンバ

メンバー名 定義
ptr
Pointer 型のポインタ。通常は allocate_at_least によって割り当てられたストレージの先頭要素のアドレスに使用される
(公開メンバーオブジェクト)
count
SizeType 型の値。通常は allocate_at_least によって割り当てられたストレージ内の実際の要素数に使用される
(公開メンバーオブジェクト)

注記

Pointer SizeType は、デフォルトではオブジェクト型へのポインタと std:: make_unsigned_t < std:: ptrdiff_t > (これはほぼ常に std::size_t と同じ)です。

機能テスト マクロ 標準 機能
__cpp_lib_allocate_at_least 202302L (C++23) アロケータインターフェースにおけるサイズフィードバック

関連項目

要求されたサイズ以上の未初期化ストレージを割り当てる
( std::allocator<T> の公開メンバ関数)
[static] (C++23)
アロケータを介して要求されたサイズ以上のストレージを割り当てる
( std::allocator_traits<Alloc> の公開静的メンバ関数)