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/bind.hpp>
14 struct X : private boost::noncopyable
16 X() { std::cout << "X()" << std::endl; }
17 ~X() { std::cout << "~X()" << std::endl; }
20 void fn( boost::coroutines::asymmetric_coroutine< void >::push_type & sink)
26 std::cout << "fn() : " << ++i << std::endl;
31 int main( int argc, char * argv[])
34 boost::coroutines::asymmetric_coroutine< void >::pull_type source( fn);
35 for ( int k = 0; k < 3; ++k)
39 std::cout << "destroying coroutine and unwinding stack" << std::endl;
42 std::cout << "\nDone" << std::endl;