lewissbaker / cppcoro

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

Having problem returning future from cppcoro::generator #190

Open Xyncgas opened 3 years ago

Xyncgas commented 3 years ago

cppcoro::generator<std::optional<std::future>> object_list (std::string* input) { ... co_yield {}; ... while(...==true) { co_yield (std::async(std::launch::async, [=]() {return HttpGetString_convertedTo_stdString(target); })) } }

int main() { for (auto element : object_list(a) { //Object_list showing error in visual studio } } image

Xyncgas commented 3 years ago

I am not a very good github user please forgive my formatting, I was exploring on my own and wanted to do something like this and I can't fix it

Xyncgas commented 3 years ago

nvm, I feel like shared_future is needed for supporting this, please close the repo after reading it