You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cppcoro::task<A> makeA();
cppcoro::task<B> makeB();
cppcoro::task<C> func(A a, B b);
cppcoro::task<C> c = cppcoro::bind(func, makeA(), makeB());
Or alternatively, should this be done with an apply operator composed with bind and when_all?
cppcoro::task<C> c =
cppcoro::when_all(makeA(), makeB())
| cppcoro::bind(cppcoro::apply(func));
// Equivalent to
cppcoro::task<C> c = [](cppcoro::task<A> a, cppcoro::task<B> b) -> cppcoro::task<C>
{
co_returnco_awaitstd::apply(func, co_awaitcppcoro::when_all(std::move(a), std::move(b)));
}(makeA(), makeB());
The text was updated successfully, but these errors were encountered:
lewissbaker
changed the title
Add 'bind' operator for monadic types
Add 'bind' operator for task types
Aug 8, 2017
Basic usage:
Variadic usage:
Or alternatively, should this be done with an
apply
operator composed withbind
andwhen_all
?The text was updated successfully, but these errors were encountered: