rename symmetric_coroutine_self -> symmetric_coroutine_yield

This commit is contained in:
Oliver Kowalke
2014-02-05 17:38:09 +01:00
parent 224bcab410
commit baabddae44
22 changed files with 201 additions and 201 deletions

View File

@@ -20,11 +20,11 @@ std::vector< int > merge( std::vector< int > const& a, std::vector< int > const&
coro_t * other_a = 0, * other_b = 0;
coro_t coro_a(
[&]( coro_t::self_type & self) {
[&]( coro_t::yield_type & yield) {
while ( idx_a < a.size() )
{
if ( b[idx_b] < a[idx_a])
self( * other_b);
yield( * other_b);
c.push_back(a[idx_a++]);
}
while ( c.size() < a.size() + b.size())
@@ -32,11 +32,11 @@ std::vector< int > merge( std::vector< int > const& a, std::vector< int > const&
});
coro_t coro_b(
[&]( coro_t::self_type & self) {
[&]( coro_t::yield_type & yield) {
while ( idx_b < b.size() )
{
if ( a[idx_a] < b[idx_b])
self( * other_a);
yield( * other_a);
c.push_back(b[idx_b++]);
}
while ( c.size() < ( a.size() + b.size() ) )

View File

@@ -17,19 +17,19 @@ int main( int argc, char * argv[])
coro_t * other2 = 0;
coro_t coro1(
[&]( coro_t::self_type & self) {
[&]( coro_t::yield_type & yield) {
std::cout << "foo1" << std::endl;
self( * other2);
yield( * other2);
std::cout << "foo2" << std::endl;
self( * other2);
yield( * other2);
std::cout << "foo3" << std::endl;
});
coro_t coro2(
[&]( coro_t::self_type & self) {
[&]( coro_t::yield_type & yield) {
std::cout << "bar1" << std::endl;
self( * other1);
yield( * other1);
std::cout << "bar2" << std::endl;
self( * other1);
yield( * other1);
std::cout << "bar3" << std::endl;
});