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));
}
{

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);
}
{
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òu)造函數(shù)。可能是g++的錯誤。