
I would like to see the coroutine-function with a void return type. Or have an option for that.
I've had such a version but I dropped it because for detecting the completeness of the coroutine would require an extra jump (return from last jump-function and calling return in the coroutine-fn). And this makes the implementation for iterators very painful: void fn( coroutine<void(int)> & c) { c( 1); c( 2); } The iterator would be required to be incremented three times. And std::distance would return 3 instead of 2.
As for output iterators, I see that it's currently only supported for coroutines with void return type and arity of 1. If a coroutine has a non-void return type, output iterator can still be defined, just ignore the return values.
I would keep the interface simple - introducing such an iterator would be a source of confusion (why is the return type ignored etc.). The users could still use such coroutines but without an iterator interface. regards, Oliver