pika icon indicating copy to clipboard operation
pika copied to clipboard

Add `pika/std::async` equivalent for senders

Open msimberg opened this issue 1 year ago • 0 comments

While working on #774 there are a lot of use cases of pika::async that need to be replaced with something more explicit, but also more verbose. The current pika::async could easily be implemented as something like

template <typename Scheduler, typename F, typename... Ts>
decltype(auto) foo(Scheduler&& sched, F&& f, Ts&&... ts)
{
    return then(
        transfer_just(std::forward<Scheduler>(sched), std::forward<Ts>(ts)...),
        std::forward<F>(f));
}

I think we should consider adding something like that to cover a common use case. However, I would not add an overload with a default scheduler as that makes it non-generic. The default depends on the context and can be added by users depending on their use case.

The question is: what should such a sender factory be called? transfer_just_then doesn't quite roll off the tongue...

msimberg avatar Sep 22 '23 07:09 msimberg