mirror of
https://github.com/boostorg/coroutine.git
synced 2026-01-31 08:02:18 +00:00
coroutine: intro of coroutine<>::pull_type, coroutine<>::push_type
[SVN r85058]
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
#include <boost/coroutine/all.hpp>
|
||||
|
||||
#ifdef BOOST_COROUTINES_UNIDIRECT
|
||||
void fibonacci( boost::coroutines::push_coroutine< int > & c)
|
||||
void fibonacci( boost::coroutines::coroutine< int >::push_type & c)
|
||||
{
|
||||
int first = 1, second = 1;
|
||||
c( first);
|
||||
c( second);
|
||||
while ( true)
|
||||
{
|
||||
int third = first + second;
|
||||
@@ -25,9 +27,9 @@ void fibonacci( boost::coroutines::push_coroutine< int > & c)
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::coroutines::pull_coroutine< int > c( fibonacci);
|
||||
boost::coroutines::coroutine< int >::pull_type c( fibonacci);
|
||||
boost::range_iterator<
|
||||
boost::coroutines::pull_coroutine< int >
|
||||
boost::coroutines::coroutine< int >::pull_type
|
||||
>::type it( boost::begin( c) );
|
||||
for ( int i = 0; i < 10; ++i)
|
||||
{
|
||||
@@ -43,6 +45,8 @@ int main()
|
||||
void fibonacci( boost::coroutines::coroutine< void( int) > & c)
|
||||
{
|
||||
int first = 1, second = 1;
|
||||
c( first);
|
||||
c( second);
|
||||
while ( true)
|
||||
{
|
||||
int third = first + second;
|
||||
|
||||
Reference in New Issue
Block a user