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

@@ -50,10 +50,10 @@ std::pair< node::ptr_t, node::ptr_t > create_diff_trees()
}
#ifdef BOOST_COROUTINES_UNIDIRECT
bool match_trees( boost::coroutines::pull_coroutine< leaf & > & c1,
boost::coroutines::pull_coroutine< leaf & > & c2)
bool match_trees( boost::coroutines::coroutine< leaf & >::pull_type & c1,
boost::coroutines::coroutine< leaf & >::pull_type & c2)
{
typedef boost::range_iterator< boost::coroutines::pull_coroutine< leaf & > >::type iterator_t;
typedef boost::range_iterator< boost::coroutines::coroutine< leaf & >::pull_type >::type iterator_t;
iterator_t i1( boost::begin( c1) );
iterator_t e1( boost::end( c1) );
iterator_t i2( boost::begin( c2) );
@@ -64,15 +64,15 @@ int main()
{
{
std::pair< node::ptr_t, node::ptr_t > pt = create_eq_trees();
boost::coroutines::pull_coroutine< leaf & > te1( boost::bind( enumerate_leafs, _1, pt.first) );
boost::coroutines::pull_coroutine< leaf & > te2( boost::bind( enumerate_leafs, _1, pt.second) );
boost::coroutines::coroutine< leaf & >::pull_type te1( boost::bind( enumerate_leafs, _1, pt.first) );
boost::coroutines::coroutine< leaf & >::pull_type te2( boost::bind( enumerate_leafs, _1, pt.second) );
bool result = match_trees( te1, te2);
std::cout << std::boolalpha << "eq. trees matched == " << result << std::endl;
}
{
std::pair< node::ptr_t, node::ptr_t > pt = create_diff_trees();
boost::coroutines::pull_coroutine< leaf & > te1( boost::bind( enumerate_leafs, _1, pt.first) );
boost::coroutines::pull_coroutine< leaf & > te2( boost::bind( enumerate_leafs, _1, pt.second) );
boost::coroutines::coroutine< leaf & >::pull_type te1( boost::bind( enumerate_leafs, _1, pt.first) );
boost::coroutines::coroutine< leaf & >::pull_type te2( boost::bind( enumerate_leafs, _1, pt.second) );
bool result = match_trees( te1, te2);
std::cout << std::boolalpha << "diff. trees matched == " << result << std::endl;
}