Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7738295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:13:40+00:00 2026-06-01T08:13:40+00:00

I create a QFuture that I want to use to parallelize calls to a

  • 0

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 :

typedef struct{
}solveModel;
class Manager {
public:
    bool compute(solveModel* model);
};

class solverParallel {
public:
  solverParallel(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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:13:41+00:00Added an answer on June 1, 2026 at 8:13 am

    From the official documentation :

    QtConcurrent::run() also accepts pointers to member functions. The
    first argument must be either a const reference or a pointer to an
    instance of the class. Passing by const reference is useful when
    calling const member functions; passing by pointer is useful for
    calling non-const member functions that modify the instance.

    You are passing a pointer to a pointer. Also notice that you cannot pass the arguments the way you do, but as extra arguments in the run function. The following should work:

    futureComput = QtConcurrent::run(this->myMgr,&Manager::compute, model);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Create a function that can have different argument list. something like this void s(int
I have tried to create a concurrent queue class, in a producer-consumer pattern. I
Create Pex test to test a DLL and hardware controlled by that DLL? I
CREATE OR REPLACE PACKAGE packet AS TYPE tip IS RECORD(a1 INT,a2 VARCHAR2(20)); FUNCTION getrow
// Create a scanner that reads from the input stream passed to us CSLexer
CREATE FUNCTION testing(id INT, dsc TEXT) RETURNS TEXT BEGIN DECLARE ntxt TEXT; SET ntxt
The QFuture class has methods such as cancel() , progressValue() , etc. These can
CREATE OR REPLACE FUNCTION _chkLogin(userid varchar, pwd varchar) RETURNS BOOLEAN AS $BODY$ DECLARE passed
Create MySQL Split String Function SPLIT_STR fedecarg.com/.../mysql-split-string-function/ CREATE FUNCTION SPLIT_STR( x VARCHAR(255), delim VARCHAR(12),
Create an array class for Employee which will reserved 7 elements. The class will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.