boost::capy::this_coro::allocator
Tag object that yields the current frame allocator when awaited.
Synopsis
Declared in <boost/capy/ex/this_coro.hpp>
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`.