On this page
std::generator<Ref,V,Allocator>::promise_type::operator new
|
(1) | (since C++23) |
|
(2) | (since C++23) |
|
(3) | (since C++23) |
Allocates size
bytes of uninitialized storage using default or user-provided allocator.
Let A
be
Allocator
, if it is not void,Alloc
for (2,3), orstd::allocator<void>
otherwise.
Let B
be std::allocator_traits<A>::template rebind_alloc<U>
where U
is an unspecified type whose size and alignment are both __STDCPP_DEFAULT_NEW_ALIGNMENT__
.
Initializes an allocator b
of type B
with:
A()
,
A(alloc)
.
Uses b
to allocate storage for the smallest array of U
sufficient to provide storage for a coroutine state of size size
, and unspecified additional state necessary to ensure that operator delete
can later deallocate this memory block with an allocator equal to b
.
Note: std::allocator_traits<B>::pointer
must be of a pointer type, otherwise the behavior is undefined.
Parameters
size | - | the size of the storage to allocate |
alloc | - | a user provided allocator of type Alloc |
Return value
A pointer to the allocated storage.
Exceptions
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/coroutine/generator/promise_type/operator_new