The python keyword yield
has been a great conceptual abstraction for me, allowing me to distill the important parts of an algorithm to human-readable form. We have previously discussed:
Python generators in various languages
where an answer was given for a windows only library in C++. In addition I've found another example using a funky macro expansion in the question:
Generators in C++ — invalid use of nonstatic data member
The edge of my computer science knowledge tells me that a yield function has something to do with co-routines and monads, but I'm not quite how this fits into what C++ or C++0x can accomplish.
It seems that in C++, without the using of a macro-expansion or a windows only fiber (thread), yeild
can not be implemented. Is this true? Does the question change with the additional language features of C++0x?