coroutine: coroutine_error + coroutine_errc

[SVN r85139]
This commit is contained in:
Oliver Kowalke
2013-07-23 19:49:38 +00:00
parent 01235d2ee7
commit 4c4f2afbd5
20 changed files with 279 additions and 71 deletions

View File

@@ -11,26 +11,26 @@
#include <boost/coroutine/all.hpp>
#ifdef BOOST_COROUTINES_UNIDIRECT
void fibonacci( boost::coroutines::coroutine< int >::push_type & c)
void fibonacci( boost::coroutines::coroutine< int >::push_type & sink)
{
int first = 1, second = 1;
c( first);
c( second);
sink( first);
sink( second);
while ( true)
{
int third = first + second;
first = second;
second = third;
c( third);
sink( third);
}
}
int main()
{
boost::coroutines::coroutine< int >::pull_type c( fibonacci);
boost::coroutines::coroutine< int >::pull_type source( fibonacci);
boost::range_iterator<
boost::coroutines::coroutine< int >::pull_type
>::type it( boost::begin( c) );
>::type it( boost::begin( source) );
for ( int i = 0; i < 10; ++i)
{
std::cout << * it << " ";