boost::capy::this_coro::allocator

Tag object that yields the current frame allocator when awaited.

Synopsis

inline constexpr allocator_tag allocator = {};

Description

Use co_await this_coro::allocator inside a coroutine whose promise type supports allocator access (e.g., inherits from io_awaitable_promise_base). The returned pointer is the memory resource used for coroutine frame allocation.

Example

task<void> example()
{
    auto* alloc = co_await this_coro::allocator;
    // alloc is nullptr when using the default allocator
}

Behavior

  • Returns `nullptr` when the default allocator is in use.

  • This operation never suspends; `await_ready()` always returns `true`.

See Also

allocator_tag

io_awaitable_promise_base

Created with MrDocs