用boost::bind构造boost::coroutine

用boost::bind构造boost::coroutine
class  TestCoro  
{  
      
  
    typedef boost::coroutines::coroutione
< void  () >  Coro;  
      
    
void  CoroFun(Coro::caller_type  &  ca);  
      
    Coro m_coro;  
};  
  
TestCoro::TestCoro()  
{  
    m_coro 
=  Coro(boost::bind( & TestCoro::CoroFun,  this , _1));  

可以在VC下编译通过。Gcc报错。需要改成
    TestCoro::TestCoro()  
    {  
        typedef boost::function
< void  (Coro::caller_type  & ) >  CoroFunType;  
        CoroFunType coroFun 
=  boost::bind( & TestCoro::CoroFun,  this , _1);  
        boost::is_function
< BOOST_RV_REF(boost::rv < Coro > ) >  noUse1;  
        boost::is_function
< BOOST_RV_REF(CoroFunType) >  noUse2;  
        m_coro 
=  Coro(coroFun);  
    } 

g++版本为:

g++ (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6)

2个is_function不加就无法确定coroutine的构造函数。可能是g++的错误。


你可能感兴趣的:(用boost::bind构造boost::coroutine)