Ticket #10546: main.cpp

File main.cpp, 585 bytes (added by Michael Tomer <Jester3141@…>, 8 years ago)
Line 
1#include <iostream>
2#include <boost/utility/enable_if.hpp>
3#include <boost/type_traits/is_convertible.hpp>
4#include <boost/coroutine/coroutine.hpp>
5#include <boost/function.hpp>
6#include <boost/bind.hpp>
7
8using namespace std;
9
10
11
12typedef boost::coroutines::coroutine<int()> routine_t;
13
14// The implementation routine of the coroutine.
15 void xrange_impl(routine_t::caller_type& yield, int limit)
16 {
17 for(int i = 0; i < limit; i++) {
18 yield(i); // return results back to the caller
19 }
20 }
21
22
23
24int main()
25{
26 routine_t foo(boost::bind(xrange_impl, _1, 10000));
27
28 return 0;
29};
30