Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-04-20 11:42:39

Python has a cool feature called generators (stolen from other
languages) which basically turns a function into an input iterator.
When the function yields a value instead of returning, that represents
the value at one position of the iterator. When the function finally
returns, the iterator is exhausted. This can be a very simple way to
code up a state machine. See:

I had a thought that we might be able to achieve something similar in
C++ using Boost.Lambda. Since the lambda library builds a function
object whose evaluation is deferred, it seems to me that it should be
possible, in theory at least, to produce the right behavior by adding
a function called "ll::yeild" (and a whole lot of code changes to
BLL)... or maybe not; I'm not familiar with the implementation and I
don't plan to get there soon.

Maybe it looks like easy pickins to Jaako, Gary, and Joel?

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at