SPyofgame's blog

By SPyofgame, history, 5 years ago, In English

I recently found the opperator co_await and co_yield in C++. How should I apply this into the code and should I use these operator in competitive programming ?

Sorry for my bad English and knowledge.

If I am wrong about something please guide me.

Thanks for reading <3

  • Vote: I like it
  • +5
  • Vote: I do not like it

»
5 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I'm not too familiar with C++, but perhaps you can use it to build lazy sequences: https://medium.com/@buckaroo.pm/introducing-conduit-lazy-sequences-using-the-coroutine-ts-b7e87dd85fcf

Other than that, I doubt you'd see much use for concurrency in CP. Maybe it could be occasionally used to send an "interrupt" when you're getting close to the time limit for certain randomized or approximation algorithms (e.g. 364D - Ghd), but such problems are rare.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

https://en.cppreference.com/w/cpp/language/coroutines From this site you can be something about it... Sir