libcoro
1.0
Coroutine support library for C++20
|
◆ operator<<()
template<typename T >
template<invocable_r_exact< future > Fn>
Store result future in already declared value. As the future cannot be copied or moved, only way to "store" result of function to existing future variable is through this operator. Note that operator accepts a function, which returns future of the exact same type future<int> doSomething(args) {...}
future<int> fut;
//... other code ...
fut << [&]{return doSomething(args);};
int res = co_await fut;
|