The future is not here yet that it's already full of resources!
It had to be done - Abusing co_await for optionals
by redditsoaddicting
From the article:
I finally got around to playing with coroutines in the context of non-future types. I always guessed this could be done. For optionals specifically, the idea is that you do auto x = co_await foo(); and either x is the value in the optional or the function immediately returns an empty optional...
Add a Comment
Comments are closed.