lewissbaker / cppcoro

A library of C++ coroutine abstractions for the coroutines TS
MIT License
3.41k stars 468 forks source link

schedule_on demotes shared_task to task #152

Open invexed opened 4 years ago

invexed commented 4 years ago

As the following example demonstrates, cppcoro::shared_tasks become cppcoro::tasks when propagating through cppcoro::schedule_on. Is this intended behaviour?

auto f() -> cppcoro::shared_task<int>
{
    co_return 0;
}

auto tp = cppcoro::static_thread_pool{};
auto g = cppcoro::schedule_on(tp, f()); // g is a cppcoro::task<int&>

https://godbolt.org/z/e3oKBG