2 // Copyright Oliver Kowalke 2009.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/coroutine/all.hpp>
12 #include <boost/range.hpp>
14 void fibonacci( boost::coroutines::asymmetric_coroutine< int >::push_type & sink)
16 int first = 1, second = 1;
21 int third = first + second;
30 boost::coroutines::asymmetric_coroutine< int >::pull_type source( fibonacci);
31 boost::range_iterator<
32 boost::coroutines::asymmetric_coroutine< int >::pull_type
33 >::type it( boost::begin( source) );
34 for ( int i = 0; i < 10; ++i)
36 std::cout << * it << " ";
40 std::cout << "\nDone" << std::endl;