
thanks Oliver,Nate,
I will deploy this once is 1.54 is released,
MM
On 19 February 2013 08:05, Oliver Kowalke
2013/2/18 Nathan Ridge
Turns out that the final version of Boost.Coroutine that made it into the 1.53 release has out-of-the-box support for treating the values returned by a coroutine as a range, which makes writing such an outputs_of() function trivial:
using boost::coroutines::coroutine; ... template
coroutine outputs_of(F f) { return coroutine {[f](typename coroutine ::caller_type& caller) { f(boost::make_function_output_iterator([&caller](const T& t){ caller(t); })); }}; } A complete example using the two functions in your original post is attached.
The code uses some C++11 features like lambdas, but these can easily be translated to their C++03 equivalents if necessary. I'll leave it to you as an exercise to do that if you need to.
Hope that helps!
Regards, Nate
boost.coroutine required some fixes releated C++11 and iterators (thank you nate) - the fixes are applied to trunk and should be available in boost-1.54. Oliver
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users