mirror of
https://github.com/boostorg/coroutine.git
synced 2026-01-31 08:02:18 +00:00
coroutine: coroutine_error + coroutine_errc
[SVN r85139]
This commit is contained in:
@@ -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 << " ";
|
||||
|
||||
Reference in New Issue
Block a user