...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Asynchronous operations may allocate memory. [Note:
Such as a data structure to store copies of the completion_handler
object and the initiating function's arguments. —end note]
Let Alloc1
be a type, satisfying the ProtoAllocator
requirements, that represents the asynchronous operation's default allocation
strategy. [Note: Typically std::allocator<void>
.
—end note] Let alloc1
be a value of type
Alloc1
.
A completion handler object of type CompletionHandler
has
an associated allocator object alloc2
of type Alloc2
satisfying the ProtoAllocator
requirements. The type Alloc2
is associated_allocator_t<CompletionHandler,
Alloc1>
. Let alloc2
be a value of type Alloc2
obtained by performing get_associated_allocator(completion_handler,
alloc1)
.
The asynchronous operations defined in this library:
— If required, allocate memory using only the completion handler's associated allocator.
— Prior to completion handler execution, deallocate any memory allocated using the completion handler's associated allocator.
[std_note The implementation may perform operating system or underlying API calls that perform memory allocations not using the associated allocator. Invocations of the allocator functions may not introduce data races (See C++Std [res.on.data.races]).]