
On 19/12/10 19:40, Brent Spillner wrote:
I uploaded sample code to the Vault (in the "Miscellaneous/" directory) that provides a concise notation for list comprehensions. The comprehensions are evaluated lazily and can be used to populate a std::list, vector, or deque, appended to the same, inserted after a given iterator, or interpreted as a boost::range, including compatibility with BOOST_FOREACH. Containers, iterator-defined ranges, or nullary function objects can be used as generators, and arbitrary function objects can be used to specify filter conditions.
I've tested this so far with GCC 4.4.4, GCC 4.5.2, and Clang 2.9, using Boost 1.42 and 1.45, and with and without -std=c++0x. Reports of success/failure with other environments are most welcome. The code is still in a prototype stage, so I'm more than happy to take design suggestions and would love to hear about use cases I've overlooked. If there's sufficient interest I will work on getting it to production quality and writing some real documentation. I apologize in advance for wasting everybody's time if something like this already exists in Phoenix; I'm not too familiar with it but I skimmed the docs and didn't see anything. I like the idea :) However, how did you manage the lazy part ? Do you roll your own lazy stuff or do you rely on proto ?
If the former, I encourage you to jump the agte and do the latter :)