I create a QFuture that I want to use to parallelize calls to a member function. More precisely, I have a class solveParallel with .h :
class solverParallel {
public:
solverParallelData(Manager* mgr_);
virtual ~solverParallel(void);
void runCompute(solveModel * model_);
bool resultComput();
private:
Manager *myMgr;
QFuture<bool> myFutureCompute;
};
where the methode runCompute() is creating the myFutureCompute member. .cpp looks like
solveParallel::solveParallel(Manager* mgr_)
:m_mgr(mgr_)
{
}
solverParallel::~solverParallel(void){}
void solverParallel::runCompute(solveModel* model)
{
futureComput = QtConcurrent::run(&this->myMgr,&Manager::compute(model));
}
bool solverParallelData::resultComput()
{
return m_futureComput.result();
}
Include(s) are all right. Compilation fails, on line
futureComput = QtConcurrent::run(&this->myMgr,&Manager::compute(model));
with this error:
Error 44 error C2784: 'QFuture<T> QtConcurrent::run(T (__cdecl *)(Param1),const Arg1 &)' : could not deduce template argument for 'T (__cdecl *) (Param1)' from 'Manager **' solverparallel.cpp 31
In addition, on mouse info for '&Manager' in same line of code stands: Error: a nonstatic member reference must be relative to a specific object.
Do you see where is the trick? Thanks and regards.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…