mirror of
https://github.com/boostorg/coroutine.git
synced 2026-01-30 07:42:52 +00:00
rename symmetric_coroutine_self -> symmetric_coroutine_yield
This commit is contained in:
@@ -24,11 +24,11 @@ private:
|
||||
return dist( gen);
|
||||
}
|
||||
|
||||
void run_( coro_t::self_type & self)
|
||||
void run_( coro_t::yield_type & yield)
|
||||
{
|
||||
int sum = 0;
|
||||
while ( ( sum += die() ) < 100)
|
||||
self( nxt->coro);
|
||||
yield( nxt->coro);
|
||||
std::cout << "player " << id << " winns" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ private:
|
||||
std::size_t max_;
|
||||
std::vector< int > & to_;
|
||||
|
||||
void run_( coro_t::self_type & self)
|
||||
void run_( coro_t::yield_type & yield)
|
||||
{
|
||||
while ( idx < from.size() )
|
||||
{
|
||||
if ( other->from[other->idx] < from[idx])
|
||||
self( other->coro);
|
||||
yield( other->coro);
|
||||
to_.push_back(from[idx++]);
|
||||
}
|
||||
while ( to_.size() < max_)
|
||||
|
||||
@@ -15,21 +15,21 @@ typedef boost::coroutines::symmetric_coroutine< void > coro_t;
|
||||
coro_t * c1 = 0;
|
||||
coro_t * c2 = 0;
|
||||
|
||||
void foo( coro_t::self_type & self)
|
||||
void foo( coro_t::yield_type & yield)
|
||||
{
|
||||
std::cout << "foo1" << std::endl;
|
||||
self( * c2);
|
||||
yield( * c2);
|
||||
std::cout << "foo2" << std::endl;
|
||||
self( * c2);
|
||||
yield( * c2);
|
||||
std::cout << "foo3" << std::endl;
|
||||
}
|
||||
|
||||
void bar( coro_t::self_type & self)
|
||||
void bar( coro_t::yield_type & yield)
|
||||
{
|
||||
std::cout << "bar1" << std::endl;
|
||||
self( * c1);
|
||||
yield( * c1);
|
||||
std::cout << "bar2" << std::endl;
|
||||
self( * c1);
|
||||
yield( * c1);
|
||||
std::cout << "bar3" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user