Goal: see coroutineYieldTest()
We get promise.mValue by calling hRange.resume().
How it’s achieved:
coroutine_handle hRange is from CReturnObjGen, which is the return from calling cofuncYield.
Coroutine cofuncYield() has a loop that keeps calling co_yield to return an integer.
Different from coroutine-1 in last post, CReturnObjGen has no base class.
It has to implement subclass promise_type.
The yield value promise.mValue is passed in by promise.yield_value(value)
CReturnObjGen holds the handle in mhCoroutine, which is passed in by ctor, which is somehow called.
cofuncYield(): upon each trigger, it passes co_yield and then loops back and block.
has no return statement even though it has return type.
Download: http://riowing.net/p/wp/coroutine.cpp