【发布时间】:2023-02-20 20:56:53
【问题描述】:
我想知道如何将分配器绑定到我的自定义令牌并在令牌的 async_result 实现中使用它?
如果我们以use_tuple为例,它似乎只适用于它自己的use_tuple.rebind(another_allocator)分配器,而不适用于用户关联的分配器或调用异步函数的对象?
在我自己的未来类型中,我想能够说
async_read(socket, buffer, bind_allocator(some_polymorphic_alloc, my::use_future));
在 my_use_future 的 async_result<my::use_future_t, Signature> 专业化中,我想使用绑定分配器。对于 bind_allocator,async_read 函数使用该分配器进行分配。但是我没有看到分配器在其 async_result<>::initiate 函数中传递到我的 my::use_future 令牌的路径。
【问题讨论】: