boost::线程池和boost::bind或boost::function

boost::线程池和boost::bind或boost::function,boost,binding,bind,threadpool,Boost,Binding,Bind,Threadpool,如何从boost线程池中获取返回值 我尝试将绑定函数附加到boost::函数: boost::function f0; //void cause the parameter passed is always the same. func = bind( static_cast(&MyClass::operator+), this, arg ); MyClass obj; threadpool.schedule( obj = &func() ) boost::函数f0//void原因传递的参

如何从boost线程池中获取返回值

我尝试将绑定函数附加到boost::函数:

boost::function f0; //void cause the parameter passed is always the same. func = bind( static_cast(&MyClass::operator+), this, arg ); MyClass obj; threadpool.schedule( obj = &func() ) boost::函数f0//void原因传递的参数始终相同。 func=bind(static_cast(&MyClass::operator+),this,arg); MyClass obj; threadpool.schedule(obj=&func()) 但它抛出了一个错误:该项不会对一个包含0个参数的函数求值

这只是我尝试的方式,可能是完全错误的

如何获取绑定函数的返回值?考虑必须在线程中调度它。
提前谢谢你

复制和过去失败!前两行是:boost::function funct//void原因传递的参数始终相同。func=bind(static_cast(&MyClass::operator+),this,arg);您应该编辑您的问题,而不是添加评论。您可以查看。它有一个解决办法