coroutine: intro of coroutine<>::pull_type, coroutine<>::push_type

[SVN r85058]
This commit is contained in:
Oliver Kowalke
2013-07-17 14:09:07 +00:00
parent c39d9509a4
commit 865902f9b5
22 changed files with 397 additions and 487 deletions

View File

@@ -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;