Hacker News new | ask | show | jobs
by gpderetta 1698 days ago
The unreliable allocation elision is very relevant for most coroutine users.

edit: also the lack of composability is relevant.

1 comments

It is possible to compose them more easily than described in the article; Lewis Baker's cppcoro library for example provides a recursive_generator<> type[0] that allows this without using any macros. It's up to the library part of coroutines to make things easy, end users are not expected to write low-level coroutine code themselves.

I wonder about the allocation elision. Return value optimization became mandatory, and some compilers can already elide calls to new/delete and malloc()/free() in normal code, so perhaps it will be possible to guarantee allocation elision in the future in the most used cases.

[0]: https://github.com/lewissbaker/cppcoro#recursive_generatort