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 타입들의 allocate_at_least 멤버 함수(예: std::allocator::allocate_at_least )와 std::allocator_traits::allocate_at_least 로부터 반환됩니다.

allocation_result 의 모든 특수화는 ptr count 이외의 기본 클래스나 선언된 멤버를 가지지 않으므로, 집합체 초기화 구조化 바인딩 에 적합합니다.

목차

템플릿 매개변수

Pointer - 일반적으로 std:: allocator_traits < Alloc > :: pointer , 여기서 Alloc Allocator 타입임
SizeType - 일반적으로 std:: allocator_traits < Alloc > :: size_type , 여기서 Alloc Allocator 타입임

데이터 멤버

멤버 이름 정의
ptr
Pointer 타입의 포인터로, 일반적으로 allocate_at_least 에 의해 할당된 저장 공간의 첫 번째 요소 주소에 사용됨
(public member object)
count
SizeType 타입의 값으로, 일반적으로 allocate_at_least 에 의해 할당된 저장 공간의 실제 요소 개수에 사용됨
(public member object)

참고 사항

Pointer SizeType 은 객체 타입에 대한 포인터와 기본적으로 std:: make_unsigned_t < std:: ptrdiff_t > 입니다(이는 거의 항상 std::size_t 와 동일합니다).

기능 테스트 매크로 표준 기능
__cpp_lib_allocate_at_least 202302L (C++23) 할당자 인터페이스의 크기 피드백

예제

참고 항목

요청된 크기 이상의 초기화되지 않은 저장 공간을 할당합니다
( std::allocator<T> 의 public 멤버 함수)
[static] (C++23)
할당자를 통해 요청된 크기 이상의 저장 공간을 할당합니다
( std::allocator_traits<Alloc> 의 public static 멤버 함수)